platform/upstream/llvm.git
4 years agoRevert "[InstCombine] do not exclude min/max from icmp with casted operand fold"
Sanjay Patel [Thu, 2 Apr 2020 13:09:17 +0000 (09:09 -0400)]
Revert "[InstCombine] do not exclude min/max from icmp with casted operand fold"

This reverts commit f2fbdf76d8d07f6a0fbd97825cbc533660d64a37.
As noted in the post-commit thread:
https://reviews.llvm.org/rGf2fbdf76d8d0
...this can obscure a min/max pattern where the components
have extra uses. We can show that the problem is independent
of this change with a slightly modified source example, so
this revert just delays/reduces the need to fix the real
problem.

We need to improve our analysis of negation or -- more
generally -- subtraction using patches like D77230 or D68408.

4 years ago[NFC] Split Knowledge retention and place it more appropriatly
Tyker [Thu, 2 Apr 2020 11:41:24 +0000 (13:41 +0200)]
[NFC] Split Knowledge retention and place it more appropriatly

Summary:
Splitting Knowledge retention into Queries in Analysis and Builder into Transform/Utils
allows Queries and Transform/Utils to use Analysis.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77171

4 years ago[LoopDataPrefetch + SystemZ] Let target decide on prefetching for each loop.
Jonas Paulsson [Thu, 31 Oct 2019 15:05:58 +0000 (16:05 +0100)]
[LoopDataPrefetch + SystemZ] Let target decide on prefetching for each loop.

This patch adds

- New arguments to getMinPrefetchStride() to let the target decide on a
  per-loop basis if software prefetching should be done even with a stride
  within the limit of the hw prefetcher.

- New TTI hook enableWritePrefetching() to let a target do write prefetching
  by default (defaults to false).

- In LoopDataPrefetch:

  - A search through the whole loop to gather information before emitting any
    prefetches. This way the target can get information via new arguments to
    getMinPrefetchStride() and emit prefetches more selectively. Collected
    information includes: Does the loop have a call, how many memory
    accesses, how many of them are strided, how many prefetches will cover
    them. This is NFC to before as long as the target does not change its
    definition of getMinPrefetchStride().

  - If a previous access to the same exact address was 'read', and the
    current one is 'write', make it a 'write' prefetch.

  - If two accesses that are covered by the same prefetch do not dominate
    each other, put the prefetch in a block that dominates both of them.

  - If a ConstantMaxTripCount is less than ItersAhead, then skip the loop.

- A SystemZ implementation of getMinPrefetchStride().

Review: Ulrich Weigand, Michael Kruse

Differential Revision: https://reviews.llvm.org/D70228

4 years ago[NFC][PowerPC] Using update_llc_test_checks.py to update atomics-regression.ll
Kang Zhang [Thu, 2 Apr 2020 12:47:35 +0000 (12:47 +0000)]
[NFC][PowerPC] Using update_llc_test_checks.py to update atomics-regression.ll

4 years ago[lldb] Change Communication::SetConnection to take a unique_ptr
Pavel Labath [Thu, 2 Apr 2020 12:40:59 +0000 (14:40 +0200)]
[lldb] Change Communication::SetConnection to take a unique_ptr

The function takes ownership of the object. This makes that explicit,
and avoids unowned pointers floating around.

4 years ago[OPENMP50]Add initial support for OpenMP 5.0 iterator.
Alexey Bataev [Wed, 1 Apr 2020 19:06:38 +0000 (15:06 -0400)]
[OPENMP50]Add initial support for OpenMP 5.0 iterator.

Added basic parsing/semantic analysis/(de)serialization support for
iterator expression introduced in OpenMP 5.0.

4 years agoRevert "[lld] Initial commit for new Mach-O backend"
Oliver Stannard [Thu, 2 Apr 2020 12:09:57 +0000 (13:09 +0100)]
Revert "[lld] Initial commit for new Mach-O backend"

This is causing buildbot failures on 32-bit hosts, for example:
http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/3636

This reverts commit 03f43b3aca363e16c45d8733400fd0083b1af4d8.

4 years ago[OpenCL] Add sub-group builtin functions
Sven van Haastregt [Thu, 2 Apr 2020 12:18:56 +0000 (13:18 +0100)]
[OpenCL] Add sub-group builtin functions

Add the sub-group builtin functions from the OpenCL Extension
specification.  This patch excludes the sub_group_barrier builtins
that take argument types not yet handled by the
`-fdeclare-opencl-builtins` machinery.

Co-authored-by: Pierre Gondois <pierre.gondois@arm.com>
4 years ago[PhaseOrdering] add test for vector trunc; NFC
Sanjay Patel [Thu, 2 Apr 2020 12:12:24 +0000 (08:12 -0400)]
[PhaseOrdering] add test for vector trunc; NFC
See discussion in D76983.

4 years ago[InstCombine] add tests for disguised vector trunc; NFC
Sanjay Patel [Wed, 1 Apr 2020 19:29:51 +0000 (15:29 -0400)]
[InstCombine] add tests for disguised vector trunc; NFC

4 years ago[LoopTerminology] Make term names bold
Stefanos Baziotis [Thu, 2 Apr 2020 11:53:18 +0000 (14:53 +0300)]
[LoopTerminology] Make term names bold

Differential Revision: https://reviews.llvm.org/D77151

4 years ago[gn build] Port 5e508b9bac0
LLVM GN Syncbot [Thu, 2 Apr 2020 11:15:00 +0000 (11:15 +0000)]
[gn build] Port 5e508b9bac0

4 years ago[llvm-dwarfdump] Add the --show-sections-sizes option
Djordje Todorovic [Thu, 2 Apr 2020 08:58:27 +0000 (10:58 +0200)]
[llvm-dwarfdump] Add the --show-sections-sizes option

Add an option to llvm-dwarfdump to calculate the bytes within
the debug sections. Dump this numbers when using --statistics
option as well.

This is an initial patch (e.g. we should support other units,
since we only support 'bytes' now).

Differential Revision: https://reviews.llvm.org/D74205

4 years agoFix "result of 32-bit shift implicitly converted to 64 bits" MSVC warning. NFCI.
Simon Pilgrim [Thu, 2 Apr 2020 11:01:47 +0000 (12:01 +0100)]
Fix "result of 32-bit shift implicitly converted to 64 bits" MSVC warning. NFCI.

The shift of 1 by an amount that is never more than 31 means that the warning is a false positive but is safe and fixes Werror builds.

4 years ago[Clang][CodeGen] Fixing mismatch between memory layout and const expressions for...
Lucas Prates [Fri, 27 Mar 2020 11:53:49 +0000 (11:53 +0000)]
[Clang][CodeGen] Fixing mismatch between memory layout and const expressions for oversized bitfields

Summary:
The construction of constants for structs/unions was conflicting the
expected memory layout for over-sized bit-fields. When building the
necessary bits for those fields, clang was ignoring the size information
computed for the struct/union memory layout and using the original data
from the AST's FieldDecl information. This caused an issue in big-endian
targets, where the field's contant was incorrectly misplaced due to
endian calculations.

This patch aims to separate the constant value from the necessary
padding bits, using the proper size information for each one of them.
With this, the layout of constants for over-sized bit-fields matches the
ABI requirements.

Reviewers: rsmith, eli.friedman, efriedma

Reviewed By: efriedma

Subscribers: efriedma, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77048

4 years ago[clang][AARCH64] Add __ARM_FEATURE_{PAC, BTI}_DEFAULT defines
Daniel Kiss [Thu, 2 Apr 2020 10:10:41 +0000 (12:10 +0200)]
[clang][AARCH64] Add __ARM_FEATURE_{PAC, BTI}_DEFAULT  defines

Summary:
As defined by Arm C Language Extensions (ACLE) these macro defines
should be set to specific values depending on -mbranch-protection.

Reviewers: chill

Reviewed By: chill

Subscribers: danielkiss, cfe-commits, kristof.beyls

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77134

4 years ago[mlir] LLVMFuncOp: provide a capability to pass attributes through to LLVM IR
Alex Zinenko [Mon, 30 Mar 2020 16:50:42 +0000 (18:50 +0200)]
[mlir] LLVMFuncOp: provide a capability to pass attributes through to LLVM IR

Summary:
LLVM IR functions can have arbitrary attributes attached to them, some of which
affect may affect code transformations. Until we can model all attributes
consistently, provide a pass-through mechanism that forwards attributes from
the LLVMFuncOp in MLIR to LLVM IR functions during translation. This mechanism
relies on LLVM IR being able to recognize string representations of the
attributes and performs some additional checking to avoid hitting assertions
within LLVM code.

Differential Revision: https://reviews.llvm.org/D77072

4 years ago[llvm-mca] Cleanup unnecessary includes from headers
Simon Pilgrim [Thu, 2 Apr 2020 10:40:24 +0000 (11:40 +0100)]
[llvm-mca] Cleanup unnecessary includes from headers

This removes some includes/forward-declarations that don't seem to be necessary in the MCA core headers

Based off a cppclean report

Differential Revision: https://reviews.llvm.org/D77073

4 years agotsan: don't check libc dependency on FreeBSD
Dmitry Vyukov [Thu, 2 Apr 2020 10:46:28 +0000 (12:46 +0200)]
tsan: don't check libc dependency on FreeBSD

This check fails on FreeBSD:
https://github.com/golang/go/issues/14481#issuecomment-607471193
It is meant to prevent regressions, so disable it on FreeBSD.

4 years ago[gn build] Port d1705c1196f
LLVM GN Syncbot [Thu, 2 Apr 2020 10:21:22 +0000 (10:21 +0000)]
[gn build] Port d1705c1196f

4 years ago[gn build] Port d08fadd6628
LLVM GN Syncbot [Thu, 2 Apr 2020 10:21:21 +0000 (10:21 +0000)]
[gn build] Port d08fadd6628

4 years ago[gn build] remove NOSORT from clang/Headers/BUILD.gn
Nico Weber [Thu, 2 Apr 2020 10:16:52 +0000 (06:16 -0400)]
[gn build] remove NOSORT from clang/Headers/BUILD.gn

Having the sync script work for this file seems better
than matching the order of headers in the cmake file.
Also, not having to manually sort the list is nice, even
if gn's automated sorting doesn't quite match the artisanal
order in the cmake file.

4 years ago[NFC][PowerPC] Add a new test case loop-comment.ll
Kang Zhang [Thu, 2 Apr 2020 10:16:02 +0000 (10:16 +0000)]
[NFC][PowerPC] Add a new test case loop-comment.ll

4 years ago[ARM] MVE VMULL patterns
David Green [Wed, 1 Apr 2020 12:58:42 +0000 (13:58 +0100)]
[ARM] MVE VMULL patterns

This adds MVE vmull patterns, which are conceptually the same as
mul(vmovl, vmovl), and so the tablegen patterns follow the same
structure.

For i8 and i16 this is simple enough, but in the i32 version the
multiply (in 64bits) is illegal, meaning we need to catch the pattern
earlier in a dag fold. Because bitcasts are involved in the zext
versions and the patterns are a little different in little and big
endian. I have only added little endian support in this patch.

Differential Revision: https://reviews.llvm.org/D76740

4 years ago[ARM] Make remaining MVE instruction predictable
David Green [Sat, 28 Mar 2020 15:32:47 +0000 (15:32 +0000)]
[ARM] Make remaining MVE instruction predictable

The unpredictable/hasSideEffects flag is usually inferred by tablegen
from whether the instruction has a tablegen pattern (and that pattern
only has a single output instruction). Now that the MVE intrinsics are
all committed and producing code, the remaining instructions still
marked as unpredictable need to be specially handled. This adds the flag
directly to instructions that need it, notably the V*MLAL instructions
and some of the MOV's.

Differential Revision: https://reviews.llvm.org/D76910

4 years agoRecommit "[lldb] Fix TestSettings.test_pass_host_env_vars on windows"
Pavel Labath [Wed, 25 Mar 2020 12:39:05 +0000 (13:39 +0100)]
Recommit "[lldb] Fix TestSettings.test_pass_host_env_vars on windows"

This patch was reverted because it introduced a failure in
TestHelloWorld.py. The reason for that was running "ls" shell command
failed as it was evaluated in an environment with an empty path. This
has now been fixed with D77123, which ensures that all shell commands
inherit the host environment, so this patch should be safe to recommit.

The original commit message was:

A defensive check in ProcessLauncherWindows meant that we would never
attempt to launch a process with a completely empty environment -- the
host environment would be used instead. Instead, I make the function add
an extra null wchar_t at the end of an empty environment. The
documentation on this is a bit fuzzy, but it seems to be what is needed
to make windows accept these kinds of environments.

Reviewers: amccarth, friss

Differential Revision: https://reviews.llvm.org/D76835

4 years ago[NFC][update_llc_test_checks] Remove the redundant SCRUB_LOOP_COMMENT_RE in asm.py
Kang Zhang [Thu, 2 Apr 2020 09:46:45 +0000 (09:46 +0000)]
[NFC][update_llc_test_checks] Remove the redundant SCRUB_LOOP_COMMENT_RE in asm.py

Summary:
In the patch: https://reviews.llvm.org/D42654
De-duplicate utils/update_{llc_,}test_checks.py, Some common part has
been move to common.py. The SCRUB_LOOP_COMMENT_RE has been moved to
common.py, but forgetting to remove from asm.py.
This patch is to remove the redundant SCRUB_LOOP_COMMENT_RE in asm.py
and use common.SCRUB_LOOP_COMMENT_RE.

4 years ago[NFC] Preparatory work for D77292
Guillaume Chatelet [Thu, 2 Apr 2020 09:30:33 +0000 (09:30 +0000)]
[NFC] Preparatory work for D77292

4 years ago[ExpandMemCmp] Allow overlaping loads in the zero-relational case.
Clement Courbet [Tue, 10 Mar 2020 08:37:24 +0000 (09:37 +0100)]
[ExpandMemCmp] Allow overlaping loads in the zero-relational case.

Summary:
This allows doing `memcmp(p, q, 7)` with 2 loads instead of a call to
memcmp.
This fixes part of PR45147.

Reviewers: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76133

4 years ago[CallSiteSplitting] Simplify isPredicateOnPHI & continue checking PHIs.
Florian Hahn [Thu, 2 Apr 2020 09:06:44 +0000 (10:06 +0100)]
[CallSiteSplitting] Simplify isPredicateOnPHI & continue checking PHIs.

As pointed out by @thakis, currently CallSiteSplitting bails out after
checking the first PHI node. We should check all PHI nodes, until we
find one where call site splitting is beneficial.

This patch also slightly simplifies the code using BasicBlock::phis().

Reviewers: davidxl, junbuml, thakis

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D77089

4 years ago[Alignment][NFC] Use more Align versions of various functions
Guillaume Chatelet [Thu, 2 Apr 2020 08:53:29 +0000 (08:53 +0000)]
[Alignment][NFC] Use more Align versions of various functions

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: MatzeB, qcolombet, arsenm, sdardis, jvesely, nhaehnle, hiraditya, jrtc27, atanasyan, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77291

4 years ago[NFC] Fix performance issue in LiveDebugVariables
OCHyams [Thu, 2 Apr 2020 07:41:25 +0000 (08:41 +0100)]
[NFC] Fix performance issue in LiveDebugVariables

When compiling AMDGPUDisassembler.cpp in a stage 1 trunk build with
CMAKE_BUILD_TYPE=RelWithDebInfo LLVM_USE_SANITIZER=Address LiveDebugVariables
accounts for 21.5% wall clock time. This fix reduces that to 1.2% by switching
out a linked list lookup with a map lookup.

Note that the linked list is still used to group UserValues by vreg. The vreg
lookups don't cause any problems in this pathological case.

This is the same idea as D68816, which was reverted, except that it is a less
intrusive fix.

Reviewed By: vsk

Differential Revision: https://reviews.llvm.org/D77226

4 years ago[Object] Add the method for checking if a section is a debug section
Djordje Todorovic [Thu, 2 Apr 2020 08:00:18 +0000 (10:00 +0200)]
[Object] Add the method for checking if a section is a debug section

Different file formats have different naming style for the debug
sections. The method is implemented for ELF, COFF and Mach-O formats.

Differential Revision: https://reviews.llvm.org/D76276

4 years agoFix RUN line in AArch64/speculation-hardening.ll
Kristof Beyls [Wed, 1 Apr 2020 18:28:54 +0000 (19:28 +0100)]
Fix RUN line in AArch64/speculation-hardening.ll

4 years ago[clang] Move branch-protection from CodeGenOptions to LangOptions
Daniel Kiss [Thu, 2 Apr 2020 08:11:01 +0000 (10:11 +0200)]
[clang] Move branch-protection from CodeGenOptions to  LangOptions

Summary:
Reason: the option has an effect on preprocessing.

Also see thread: http://lists.llvm.org/pipermail/cfe-dev/2020-March/065014.html

Reviewers: chill, efriedma

Reviewed By: efriedma

Subscribers: efriedma, danielkiss, cfe-commits, kristof.beyls

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77131

4 years ago[lit] Improve handling of timeouts and max failures
Julian Lettner [Wed, 27 Feb 2019 06:28:41 +0000 (22:28 -0800)]
[lit] Improve handling of timeouts and max failures

This work prepares us for the overall goal of clean shutdown on user
keyboard interrupt [Ctrl+C].

4 years ago[X86] Add SERIALIZE instruction.
WangTianQing [Thu, 2 Apr 2020 08:15:34 +0000 (16:15 +0800)]
[X86] Add SERIALIZE instruction.

Summary: For more details about this instruction, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Reviewers: craig.topper, RKSimon, LuoYuanke

Reviewed By: craig.topper

Subscribers: mgorny, hiraditya, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77193

4 years agoRevert "[NFC][X86] Refine code in X86AsmBackend"
Shengchen Kan [Thu, 2 Apr 2020 07:57:06 +0000 (15:57 +0800)]
Revert "[NFC][X86] Refine code in X86AsmBackend"

This reverts commit a157cde0ac0a804b49f50df0a6faae7416ac3fb4.

4 years ago[NFC][X86] Refine code in X86AsmBackend
Shengchen Kan [Thu, 2 Apr 2020 07:33:52 +0000 (15:33 +0800)]
[NFC][X86] Refine code in X86AsmBackend

Replace pattern getContents().size with universe function call

4 years ago[clangd] Fix an assertion crash in ReferenceFinder.
Haojian Wu [Thu, 2 Apr 2020 07:29:16 +0000 (09:29 +0200)]
[clangd] Fix an assertion crash in ReferenceFinder.

Summary: The assertion is almost correct, but it fails on refs from non-preamble

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77222

4 years agoRevert "[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`"
Johannes Doerfert [Thu, 2 Apr 2020 07:23:22 +0000 (02:23 -0500)]
Revert "[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`"

This reverts commit c18d55998b3352e6ec92ccb8a3240a16a57c61e6.

Bots have reported uses that need changing, e.g.,
  clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cp
as reported by
  http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/46591

4 years ago[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`
Johannes Doerfert [Tue, 31 Mar 2020 00:58:40 +0000 (19:58 -0500)]
[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`

This is a cleanup and normalization patch that also enables reuse with
Flang later on. A follow up will clean up and move the directive ->
clauses mapping.

Differential Revision: https://reviews.llvm.org/D77112

4 years ago[OpenMP][FIX] Undo changes accidentally already introduced in NFC commit
Johannes Doerfert [Thu, 2 Apr 2020 06:30:30 +0000 (01:30 -0500)]
[OpenMP][FIX] Undo changes accidentally already introduced in NFC commit

In d1705c1196fe (D77238) we accidentally included subsequent changes and
did not only move the code into a new file (which was the intention).
We undo the changes now and re-introduce them with the appropriate test
changes later.

4 years ago[llvm-exegesis] 'Min' repetition mode
Roman Lebedev [Thu, 2 Apr 2020 06:28:35 +0000 (09:28 +0300)]
[llvm-exegesis] 'Min' repetition mode

Summary:
As noted in documentation, different repetition modes have different trade-offs:

> .. option:: -repetition-mode=[duplicate|loop]
>
>  Specify the repetition mode. `duplicate` will create a large, straight line
>  basic block with `num-repetitions` copies of the snippet. `loop` will wrap
>  the snippet in a loop which will be run `num-repetitions` times. The `loop`
>  mode tends to better hide the effects of the CPU frontend on architectures
>  that cache decoded instructions, but consumes a register for counting
>  iterations.

Indeed. Example:

>>! In D74156#1873657, @lebedev.ri wrote:
> At least for `CMOV`, i'm seeing wildly different results
> |           | Latency | RThroughput |
> | duplicate | 1       | 0.8         |
> | loop      | 2       | 0.6         |
> where latency=1 seems correct, and i'd expect the througput to be close to 1/2 (since there are two execution units).

This isn't great for analysis, at least for schedule model development.

As discussed in excruciating detail in

>>! In D74156#1924514, @gchatelet wrote:
>>>! In D74156#1920632, @lebedev.ri wrote:
>> ... did that explanation of the question i'm having made any sense?
>
> Thx for digging in the conversation !
> Ok it makes more sense now.
>
> I discussed it a bit with @courbet:
>  - We want the analysis tool to stay simple so we'd rather not make it knowledgeable of the repetition mode.
>  - We'd like to still be able to select either repetition mode to dig into special cases
>
> So we could add a third `min` repetition mode that would run both and take the minimum. It could be the default option.
> Would you have some time to look what it would take to add this third mode?

there appears to be an agreement that it is indeed sub-par,
and that we should provide an optional, measurement (not analysis!) -time
way to rectify the situation.

However, the solutions isn't entirely straight-forward.

We can just add an actual 'multiplexer' `MinSnippetRepetitor`, because
if we just concatenate snippets produced by `DuplicateSnippetRepetitor`
and `LoopSnippetRepetitor` and run+measure that, the measurement will
naturally be different from what we'd get by running+measuring
them separately and taking the min.
([[ https://www.wolframalpha.com/input/?i=%28x%2By%29%2F2+%21%3D+min%28x%2C+y%29 | `time(D+L)/2 != min(time(D), time(L))` ]])

Also, it seems best to me to have a single snippet instead of generating
a snippet per repetition mode, since the only difference here is that the
loop repetition mode reserves one register for loop counter.

As far as i can tell, we can either teach `BenchmarkRunner::runConfiguration()`
to produce a single report given multiple repetitors (as in the patch),
or do that one layer higher - don't modify `BenchmarkRunner::runConfiguration()`,
produce multiple reports, don't actually print each one, but aggregate them somehow
and only print the final one.

Initially i've gone ahead with the latter approach, but it didn't look like a natural fit;
the former (as in the diff) does seem like a better fit to me.

There's also a question of the test coverage. It sure currently does work here:
```
$ ./bin/llvm-exegesis --opcode-name=CMOV64rr --mode=inverse_throughput --repetition-mode=duplicate
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-8fb949.o
---
mode:            inverse_throughput
key:
  instructions:
    - 'CMOV64rr RAX RAX R11 i_0x0'
    - 'CMOV64rr RBP RBP R15 i_0x0'
    - 'CMOV64rr RBX RBX RBX i_0x0'
    - 'CMOV64rr RCX RCX RBX i_0x0'
    - 'CMOV64rr RDI RDI R10 i_0x0'
    - 'CMOV64rr RDX RDX RAX i_0x0'
    - 'CMOV64rr RSI RSI RAX i_0x0'
    - 'CMOV64rr R8 R8 R8 i_0x0'
    - 'CMOV64rr R9 R9 RDX i_0x0'
    - 'CMOV64rr R10 R10 RBX i_0x0'
    - 'CMOV64rr R11 R11 R14 i_0x0'
    - 'CMOV64rr R12 R12 R9 i_0x0'
    - 'CMOV64rr R13 R13 R12 i_0x0'
    - 'CMOV64rr R14 R14 R15 i_0x0'
    - 'CMOV64rr R15 R15 R13 i_0x0'
  config:          ''
  register_initial_values:
    - 'RAX=0x0'
    - 'R11=0x0'
    - 'EFLAGS=0x0'
    - 'RBP=0x0'
    - 'R15=0x0'
    - 'RBX=0x0'
    - 'RCX=0x0'
    - 'RDI=0x0'
    - 'R10=0x0'
    - 'RDX=0x0'
    - 'RSI=0x0'
    - 'R8=0x0'
    - 'R9=0x0'
    - 'R14=0x0'
    - 'R12=0x0'
    - 'R13=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: inverse_throughput, value: 0.819, per_snippet_value: 12.285 }
error:           ''
info:            instruction has tied variables, using static renaming.
assembled_snippet: 5541574156415541545348B8000000000000000049BB00000000000000004883EC08C7042400000000C7442404000000009D48BD000000000000000049BF000000000000000048BB000000000000000048B9000000000000000048BF000000000000000049BA000000000000000048BA000000000000000048BE000000000000000049B8000000000000000049B9000000000000000049BE000000000000000049BC000000000000000049BD0000000000000000490F40C3490F40EF480F40DB480F40CB490F40FA480F40D0480F40F04D0F40C04C0F40CA4C0F40D34D0F40DE4D0F40E14D0F40EC4D0F40F74D0F40FD490F40C35B415C415D415E415F5DC3
...
$ ./bin/llvm-exegesis --opcode-name=CMOV64rr --mode=inverse_throughput --repetition-mode=loop
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-051eb3.o
---
mode:            inverse_throughput
key:
  instructions:
    - 'CMOV64rr RAX RAX R11 i_0x0'
    - 'CMOV64rr RBP RBP RSI i_0x0'
    - 'CMOV64rr RBX RBX R9 i_0x0'
    - 'CMOV64rr RCX RCX RSI i_0x0'
    - 'CMOV64rr RDI RDI RBP i_0x0'
    - 'CMOV64rr RDX RDX R9 i_0x0'
    - 'CMOV64rr RSI RSI RDI i_0x0'
    - 'CMOV64rr R9 R9 R12 i_0x0'
    - 'CMOV64rr R10 R10 R11 i_0x0'
    - 'CMOV64rr R11 R11 R9 i_0x0'
    - 'CMOV64rr R12 R12 RBP i_0x0'
    - 'CMOV64rr R13 R13 RSI i_0x0'
    - 'CMOV64rr R14 R14 R14 i_0x0'
    - 'CMOV64rr R15 R15 R10 i_0x0'
  config:          ''
  register_initial_values:
    - 'RAX=0x0'
    - 'R11=0x0'
    - 'EFLAGS=0x0'
    - 'RBP=0x0'
    - 'RSI=0x0'
    - 'RBX=0x0'
    - 'R9=0x0'
    - 'RCX=0x0'
    - 'RDI=0x0'
    - 'RDX=0x0'
    - 'R12=0x0'
    - 'R10=0x0'
    - 'R13=0x0'
    - 'R14=0x0'
    - 'R15=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: inverse_throughput, value: 0.6083, per_snippet_value: 8.5162 }
error:           ''
info:            instruction has tied variables, using static renaming.
assembled_snippet: 5541574156415541545348B8000000000000000049BB00000000000000004883EC08C7042400000000C7442404000000009D48BD000000000000000048BE000000000000000048BB000000000000000049B9000000000000000048B9000000000000000048BF000000000000000048BA000000000000000049BC000000000000000049BA000000000000000049BD000000000000000049BE000000000000000049BF000000000000000049B80200000000000000490F40C3480F40EE490F40D9480F40CE480F40FD490F40D1480F40F74D0F40CC4D0F40D34D0F40D94C0F40E54C0F40EE4D0F40F64D0F40FA4983C0FF75C25B415C415D415E415F5DC3
...
$ ./bin/llvm-exegesis --opcode-name=CMOV64rr --mode=inverse_throughput --repetition-mode=min
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-c7a47d.o
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-2581f1.o
---
mode:            inverse_throughput
key:
  instructions:
    - 'CMOV64rr RAX RAX R11 i_0x0'
    - 'CMOV64rr RBP RBP R10 i_0x0'
    - 'CMOV64rr RBX RBX R10 i_0x0'
    - 'CMOV64rr RCX RCX RDX i_0x0'
    - 'CMOV64rr RDI RDI RAX i_0x0'
    - 'CMOV64rr RDX RDX R9 i_0x0'
    - 'CMOV64rr RSI RSI RAX i_0x0'
    - 'CMOV64rr R9 R9 RBX i_0x0'
    - 'CMOV64rr R10 R10 R12 i_0x0'
    - 'CMOV64rr R11 R11 RDI i_0x0'
    - 'CMOV64rr R12 R12 RDI i_0x0'
    - 'CMOV64rr R13 R13 RDI i_0x0'
    - 'CMOV64rr R14 R14 R9 i_0x0'
    - 'CMOV64rr R15 R15 RBP i_0x0'
  config:          ''
  register_initial_values:
    - 'RAX=0x0'
    - 'R11=0x0'
    - 'EFLAGS=0x0'
    - 'RBP=0x0'
    - 'R10=0x0'
    - 'RBX=0x0'
    - 'RCX=0x0'
    - 'RDX=0x0'
    - 'RDI=0x0'
    - 'R9=0x0'
    - 'RSI=0x0'
    - 'R12=0x0'
    - 'R13=0x0'
    - 'R14=0x0'
    - 'R15=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: inverse_throughput, value: 0.6073, per_snippet_value: 8.5022 }
error:           ''
info:            instruction has tied variables, using static renaming.
assembled_snippet: 5541574156415541545348B8000000000000000049BB00000000000000004883EC08C7042400000000C7442404000000009D48BD000000000000000049BA000000000000000048BB000000000000000048B9000000000000000048BA000000000000000048BF000000000000000049B9000000000000000048BE000000000000000049BC000000000000000049BD000000000000000049BE000000000000000049BF0000000000000000490F40C3490F40EA490F40DA480F40CA480F40F8490F40D1480F40F04C0F40CB4D0F40D44C0F40DF4C0F40E74C0F40EF4D0F40F14C0F40FD490F40C3490F40EA5B415C415D415E415F5DC35541574156415541545348B8000000000000000049BB00000000000000004883EC08C7042400000000C7442404000000009D48BD000000000000000049BA000000000000000048BB000000000000000048B9000000000000000048BA000000000000000048BF000000000000000049B9000000000000000048BE000000000000000049BC000000000000000049BD000000000000000049BE000000000000000049BF000000000000000049B80200000000000000490F40C3490F40EA490F40DA480F40CA480F40F8490F40D1480F40F04C0F40CB4D0F40D44C0F40DF4C0F40E74C0F40EF4D0F40F14C0F40FD4983C0FF75C25B415C415D415E415F5DC3
...
```
but i open to suggestions as to how test that.

I also have gone with the suggestion to default to this new mode.
This was irking me for some time, so i'm happy to finally see progress here.
Looking forward to feedback.

Reviewers: courbet, gchatelet

Reviewed By: courbet, gchatelet

Subscribers: mstojanovic, RKSimon, llvm-commits, courbet, gchatelet

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76921

4 years ago[libc++] Simplify the configuration of the C++ ABI library
Louis Dionne [Thu, 2 Apr 2020 06:09:23 +0000 (02:09 -0400)]
[libc++] Simplify the configuration of the C++ ABI library

This commit removes support for building against the system libc++abi,
which was supported on Apple platforms. This is basically never what we
want to do, since libc++ and libc++abi are coupled and building a trunk
libc++ against an older libc++abi can lead to incompatibilities (and
good luck debugging them!). It might have made some sense to support
that when the monorepo did not exist, however I don't think this is
anything but a footgun nowadays.

Furthermore, based on the newly-made assumption that we're building
against the monorepo libc++abi, we can simplify the search path logic
for finding libc++abi.

This area of our build system has a lot of technical debt accumulated,
and it's surprisingly difficult to change. We've tried different things
and failed several times in the past. I did test this change on our
Docker image for the build bots and on Apple platforms, however it is
possible that this breaks some unknown configuration, in which case it
should be fine to revert this (so we can try again!).

4 years ago[PPCInstPrinter] Delete an unneeded overload of printBranchOperand. NFC
Fangrui Song [Thu, 2 Apr 2020 05:40:56 +0000 (22:40 -0700)]
[PPCInstPrinter] Delete an unneeded overload of printBranchOperand. NFC

It was added by D76591 for migration purposes (not all
printBranchOperand users have migrated to the overload with `uint64_t Address`).
Now that all have been migrated, the parameter can go away.

4 years ago[PPCInstPrinter] Change B to print the target address in hexadecimal form
Fangrui Song [Thu, 2 Apr 2020 05:09:28 +0000 (22:09 -0700)]
[PPCInstPrinter] Change B to print the target address in hexadecimal form

Follow-up of D76591 and D76907

4 years ago[OpenMP][FIX] Add second include after header was split in d1705c1196
Johannes Doerfert [Thu, 2 Apr 2020 05:18:01 +0000 (00:18 -0500)]
[OpenMP][FIX] Add second include after header was split in d1705c1196

The math wrapper handling is going to be replaced shortly and
d1705c1196fedfe927716923ac121f1134924a36 was actually a precursor for
that.

4 years ago[openmp] Disable tests flaky on Debian
Vitaly Buka [Thu, 2 Apr 2020 04:56:22 +0000 (21:56 -0700)]
[openmp] Disable tests flaky on Debian

https://bugs.llvm.org/show_bug.cgi?id=45397

4 years ago[CUDA][NFC] Split math.h functions out of __clang_cuda_device_functions.h
Johannes Doerfert [Thu, 2 Apr 2020 03:22:13 +0000 (22:22 -0500)]
[CUDA][NFC] Split math.h functions out of __clang_cuda_device_functions.h

This is not supported to change anything but allow us to reuse the math
functions separately from the device functions, e.g., source them at
different times. This will be used by the OpenMP overlay.

This also adds two `return` keywords that were missing.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D77238

4 years ago[LLD][ELF] Follow the common pattern in a message about an undefined vtable symbol.
Igor Kudrin [Tue, 31 Mar 2020 10:36:23 +0000 (17:36 +0700)]
[LLD][ELF] Follow the common pattern in a message about an undefined vtable symbol.

In most cases, LLD prints its multiline diagnostic messages starting
additional lines with ">>> ". That greatly helps external tools to parse
the output, simplifying combining several lines of the log back into one
message. The patch fixes the only message I found that does not follow
the common pattern.

Differential Revision: https://reviews.llvm.org/D77132

4 years agoCorrect copy-pasteo in lua script language description
Ed Maste [Thu, 2 Apr 2020 03:57:16 +0000 (23:57 -0400)]
Correct copy-pasteo in lua script language description

4 years ago[DOC] Remove too strong restriction for ‘llvm.experimental.gc.statepoint’ Intrinsic
Serguei Katkov [Tue, 31 Mar 2020 05:07:11 +0000 (12:07 +0700)]
[DOC] Remove too strong restriction for â€˜llvm.experimental.gc.statepoint’ Intrinsic

The requirement for deopt parameter to be in gc parameter if it can
be modified by GC is very strong and difficult to follow.

The key example of why this can't work:
%p1 = bitcast i8* %p to i8*
statepoint [gc = (%p1)], [deopt = (%p1)]

The optimizer is allowed to replace either use (or both) of %p1 with %p.
If it updates only one of the two (entirely legal), the two sets do not overlap.

So this change removes the strong wording.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D77122

4 years ago[cmake] Only set deps for an ExternalProject if the type is executable or library
Nathan Lanza [Tue, 31 Mar 2020 00:22:52 +0000 (20:22 -0400)]
[cmake] Only set deps for an ExternalProject if the type is executable or library

Summary:
cmake fails with an error when attempting to evaluate $<TARGET_FILE:tgt>
where `tgt` is defined via an `add_custom_target` and thus the `TYPE`
is `UTILITY`. Requesting a TARGET_FILE only works on an `EXECUTABLE`
or one of a few differetnt types of `X_LIBRARY` (e.g. added via
`add_library` or `add_executable`). The logic as implemented in cmake
is below:

  enum TargetType
  {
    EXECUTABLE,
    STATIC_LIBRARY,
    SHARED_LIBRARY,
    MODULE_LIBRARY,
    OBJECT_LIBRARY,
    UTILITY,
    GLOBAL_TARGET,
    INTERFACE_LIBRARY,
    UNKNOWN_LIBRARY
  };

  if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
      target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
    ::reportError(context, content->GetOriginalExpression(),
                  "Target \"" + name +
                    "\" is not an executable or library.");
    return nullptr;
  }

This has always been the case back to at least 3.12 (furthest I
checked) but this is causing a new failure in cmake 3.17 while
evaluating ExternalProjectAdd.

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77284

4 years ago[Attributor] Use the proper context instruction in genericValueTraversal
Johannes Doerfert [Thu, 2 Apr 2020 03:05:24 +0000 (22:05 -0500)]
[Attributor] Use the proper context instruction in genericValueTraversal

There was a TODO in genericValueTraversal to provide the context
instruction and due to the lack of it users that wanted one just used
something available. Unfortunately, using a fixed instruction is wrong
in the presence of PHIs so we need to update the context instruction
properly.

Reviewed By: uenoku

Differential Revision: https://reviews.llvm.org/D76870

4 years ago[Attributor][FIX] Do not compute ranges for arguments of declarations
Johannes Doerfert [Mon, 23 Mar 2020 06:11:39 +0000 (01:11 -0500)]
[Attributor][FIX] Do not compute ranges for arguments of declarations

This cannot be triggered right now, as far as I know, but it doesn't
make sense to deduce a constant range on arguments of declarations.
Exposed during testing of AAValueSimplify extensions.

4 years ago[Utils][FIX] Properly deal with occasionally deleted functions
Johannes Doerfert [Thu, 2 Apr 2020 02:54:46 +0000 (21:54 -0500)]
[Utils][FIX] Properly deal with occasionally deleted functions

While D68850 allowed functions to be deleted I accidentally saved some
version of the function to be used once a suitable prefix was found.
This turned out to be problematic when the occasionally deleted function
is also occasionally modified. The test case is adjusted to resemble the
case in which the problem was found.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D76586

4 years ago[Attributor][NFC] Predetermine the module
Johannes Doerfert [Tue, 17 Mar 2020 01:18:07 +0000 (20:18 -0500)]
[Attributor][NFC] Predetermine the module

It could happen that we delete the first function in the SCC in the
future so we should be careful accessing `Functions` after the manifest
stage.

4 years ago[Attributor] Derive better alignment for accessed pointers
Johannes Doerfert [Thu, 2 Apr 2020 02:46:03 +0000 (21:46 -0500)]
[Attributor] Derive better alignment for accessed pointers

Use DL & ABI information for better alignment deduction, e.g., if a type
is accessed and the ABI specifies an alignment requirement for such an
access we can use it. This is based on a patch by @lebedev.ri and
inspired by getBaseAlign in Loads.cpp.

Depends on D76673.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D76674

4 years agoRevert "[ORC] Export __cxa_atexit from the main JITDylib in LLJIT."
Nico Weber [Thu, 2 Apr 2020 02:46:09 +0000 (22:46 -0400)]
Revert "[ORC] Export __cxa_atexit from the main JITDylib in LLJIT."

This reverts commit 0071eaaf0892d7ef733578312abefdcf84311071.
Inputs/noop-main.ll wasn't checked in, so this breaks check-llvm
everywhere.

4 years ago[Attributor][FIX] Prevent alignment breakage wrt. must-tail calls
Johannes Doerfert [Thu, 2 Apr 2020 02:07:41 +0000 (21:07 -0500)]
[Attributor][FIX] Prevent alignment breakage wrt. must-tail calls

If we have a must-tail call the callee and caller need to have matching
ABIs. Part of that is alignment which we might modify when we deduce
alignment of arguments of either. Since we would need to keep them in
sync, which is not as simple, we simply avoid deducing alignment for
arguments of the must-tail caller or callee.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D76673

4 years ago[Attributor][NFC] Cleanup leftover check lines
Johannes Doerfert [Tue, 24 Mar 2020 07:30:32 +0000 (02:30 -0500)]
[Attributor][NFC] Cleanup leftover check lines

4 years agoFix infinite recursion in deferred diag emitter
Yaxun (Sam) Liu [Fri, 27 Mar 2020 16:38:20 +0000 (12:38 -0400)]
Fix infinite recursion in deferred diag emitter

Currently deferred diagnostic emitter checks variable decl in DeclRefExpr, which
causes infinite recursion for cases like long a = (long)&a;.

Deferred diagnostic emitter does not need check variable decls in DeclRefExpr
since reference of a variable does not cause emission of functions directly or
indirectly. Therefore there is no need to check variable decls in DeclRefExpr.

Differential Revision: https://reviews.llvm.org/D76937

4 years ago[libc++] Execute tests from the Lit execution root instead of the test tree
Louis Dionne [Wed, 1 Apr 2020 22:48:22 +0000 (18:48 -0400)]
[libc++] Execute tests from the Lit execution root instead of the test tree

Instead of executing tests from within the libc++ test suite, we execute
them from the Lit execution directory. However, since some tests have
file dependencies, we must copy those dependencies to the execution
directory where they are executed.

This has the major benefit that if a test modifies a file (whether it
is wanted or not), other tests will not see those modifications. This
is good because current tests assume that input data is never modified,
however this could be an incorrect assumption if some test does not
behave properly.

4 years ago[libc++] Add missing FILE_DEPENDENCIES markup
Louis Dionne [Wed, 1 Apr 2020 23:51:37 +0000 (19:51 -0400)]
[libc++] Add missing FILE_DEPENDENCIES markup

4 years ago[ORC] Export __cxa_atexit from the main JITDylib in LLJIT.
Lang Hames [Wed, 1 Apr 2020 22:28:28 +0000 (15:28 -0700)]
[ORC] Export __cxa_atexit from the main JITDylib in LLJIT.

Failure to export __cxa_atexit can lead to an attempt to import a definition
from the process itself (if __cxa_atexit is referenced from another JITDylib),
but the process definition will clash with the existing non-exported definition
to produce an unexpected DuplicateDefinitionError.

This patch fixes the immediate issue by exporting __cxa_atexit. It also fixes a
bug where atexit functions in other JITDylibs were not being run by adding a
copy of run_atexits_helper to every JITDylib.

A follow up patch will deal with the bug where definition generators are called
despite a non-exported definition being present.

4 years agoRevert "Preserve the owning module information from DWARF in the synthesized AST"
Adrian Prantl [Thu, 2 Apr 2020 01:58:11 +0000 (18:58 -0700)]
Revert "Preserve the owning module information from DWARF in the synthesized AST"

This reverts commit 4354dfbdf5c8510a7ddff10ae67a28e16cf7cc79 while investigating bot fallout.

4 years ago[Attributor][NFC] Use a BumpPtrAllocator to allocate `AbstractAttribute`s
Johannes Doerfert [Thu, 2 Apr 2020 01:41:35 +0000 (20:41 -0500)]
[Attributor][NFC] Use a BumpPtrAllocator to allocate `AbstractAttribute`s

We create a lot of AbstractAttributes and they live as long as
the Attributor does. It seems reasonable to allocate them via a
BumpPtrAllocator owned by the Attributor.

Reviewed By: baziotis

Differential Revision: https://reviews.llvm.org/D76589

4 years ago[LangRef][AliasAnalysis] Clarify `noalias` affects only modified objects
Johannes Doerfert [Thu, 2 Apr 2020 01:40:14 +0000 (20:40 -0500)]
[LangRef][AliasAnalysis] Clarify `noalias` affects only modified objects

We already mention that `noalias` is modeled after the C99 `restrict`
qualifier but we did omit one important requirement in the description.
For the restrict guarantees the object affected has to be modified
during the execution of the function, in any way (see 6.7.3.1.4 in [0]).

There are two reasons we want this restriction as well:
  1) To match the `restrict` semantics when we lower it to `noalias`.
  2) To allow the reasoning that the object pointed to by a `noalias`
     pointer is not modified through means not derived from this
     pointer. Hence, following the uses of that pointer is sufficient
     to determine potential modifications.

The discussion on this came up as part of D73428. In that patch the
Attributor is taught to derive `noalias` for call site arguments based
on alias queries against objects that are accessed in the callee. This
is possible even if the pointer passed at the call site was "not-`noalias`".
To simplify the logic there *and* to allow the use of `noalias` as
described in 2) above, it is beneficial to follow the C `restrict`
semantics in cases where there might be "read-read-aliases". Note that
 AliasAnalysis* queries for read only objects already result in
 `NoAlias` even if the pointers might "alias".

 * From this point of view our Alias Analysis is basically a Dependence
   Analysis.

[0] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D74935

4 years agoPreserve the owning module information from DWARF in the synthesized AST
Adrian Prantl [Wed, 4 Mar 2020 17:30:12 +0000 (09:30 -0800)]
Preserve the owning module information from DWARF in the synthesized AST

Types that came from a Clang module are nested in DW_TAG_module tags
in DWARF. This patch recreates the Clang module hierarchy in LLDB and
sets the owning module information accordingly. My primary motivation
is to facilitate looking up per-module APINotes for individual
declarations, but this likely also has other applications.

rdar://problem/59634380

Differential Revision: https://reviews.llvm.org/D75488

4 years agoRemove const qualifier from Modules returned by ExternalASTSource. (NFC)
Adrian Prantl [Tue, 17 Mar 2020 19:51:58 +0000 (12:51 -0700)]
Remove const qualifier from Modules returned by ExternalASTSource. (NFC)

This API is used by LLDB to attach owning module information to
Declarations deserialized from DWARF.

Differential Revision: https://reviews.llvm.org/D75561

4 years ago[libcxx] Stop using builtin type traits for is_floating_point and is_arithmetic.
zoecarver [Wed, 1 Apr 2020 23:56:12 +0000 (16:56 -0700)]
[libcxx] Stop using builtin type traits for is_floating_point and is_arithmetic.

Based on an issue brought up in https://reviews.llvm.org/D67900, this commit reverts the changes to is_floating_point and  is_arithmetic made in D67900.

After D67900 landed, __float128 behaved differently in those two type traits, causing compiler errors in numeric limits (and possibly others).

4 years ago[WebAssembly] EmscriptenEHSjLj: Mark __invoke_ functions as imported
Sam Clegg [Wed, 1 Apr 2020 04:45:57 +0000 (21:45 -0700)]
[WebAssembly] EmscriptenEHSjLj: Mark __invoke_ functions as imported

This means the linker will be expect them be undefined at link time an
will generate imports from the `env` module rather than reporting
undefined externals.

Differential Revision: https://reviews.llvm.org/D77192

4 years agoReapply: [Host.mm] Check for the right macro instead of inlining it
Vedant Kumar [Mon, 10 Feb 2020 22:35:00 +0000 (14:35 -0800)]
Reapply: [Host.mm] Check for the right macro instead of inlining it

Previously, this was reverted in bf65f19b becuase it checked whether
TARGET_OS_EMBEDDED is defined, but that macro is always defined.

Update the condition to check that TARGET_OS_OSX is true.

4 years ago[MLIR][NFC] drop unnecessary matches in affine dma generate test case
Uday Bondhugula [Wed, 1 Apr 2020 21:04:15 +0000 (02:34 +0530)]
[MLIR][NFC] drop unnecessary matches in affine dma generate test case

 Drop unnecessary matches in affine DMA generate test case.

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77243

4 years ago[MLIR] Add method to drop duplicate result exprs from AffineMap
Uday Bondhugula [Wed, 1 Apr 2020 19:58:09 +0000 (01:28 +0530)]
[MLIR] Add method to drop duplicate result exprs from AffineMap

Add a method that given an affine map returns another with just its unique
results. Use this to drop redundant bounds in max/min for affine.for. Update
affine.for's canonicalization pattern and createCanonicalizedForOp to use
this.

Differential Revision: https://reviews.llvm.org/D77237

4 years ago[mlir] Move LLVMPassIncGen to LLVMIR/Transforms/CMakeLists.txt
River Riddle [Wed, 1 Apr 2020 21:00:49 +0000 (14:00 -0700)]
[mlir] Move LLVMPassIncGen to LLVMIR/Transforms/CMakeLists.txt

This fixes a build error with the make generator for a missing
sub-directory.

4 years agoRevert "[intel-pt] Implement a basic test case"
Walter Erquinigo [Wed, 1 Apr 2020 21:08:19 +0000 (14:08 -0700)]
Revert "[intel-pt] Implement a basic test case"

This reverts commit c911cc6c49394909a335c8d7baffcfd8bdcc424b.

4 years ago[intel-pt] Implement a basic test case
Walter Erquinigo [Tue, 31 Mar 2020 00:26:58 +0000 (17:26 -0700)]
[intel-pt] Implement a basic test case

Summary:
Depends on D76872.

There was no test for the Intel PT support on LLDB, so I'm creating one, which
will help making progress on solid grounds.

The test is skipped if the Intel PT plugin library is not built.

Reviewers: clayborg, labath, kusmour, aadsm

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77107

4 years ago[libc++] SSH: Create a tarball of dependencies and scp that instead
Louis Dionne [Wed, 1 Apr 2020 18:52:12 +0000 (14:52 -0400)]
[libc++] SSH: Create a tarball of dependencies and scp that instead

The benefit of doing this is that we can now handle directories that
contain symlinks and other arbitrary things, such as the static_test_env
required by filesystem tests.

As a fly-by fix, we also accumulate several commands to perform over SSH
and execute them at once instead of SSHing several times. This should be
faster on average.

4 years agoRevert "[intel-pt] Implement a basic test case"
Walter Erquinigo [Wed, 1 Apr 2020 20:27:13 +0000 (13:27 -0700)]
Revert "[intel-pt] Implement a basic test case"

This reverts commit f1242ec54306c5fbdc9a907e936be899a0ad21ee.

4 years agoUpdating the documentation for the noescape attribute.
Aaron Ballman [Wed, 1 Apr 2020 20:19:25 +0000 (16:19 -0400)]
Updating the documentation for the noescape attribute.

A question came up from a glibc maintainer as to whether it was permissible to
free a pointer marked [[clang::noescape]], and after investigation, I
determined that this is allowed. This updates the documentation in case others
have the same question.

4 years agoDebugInfo: Defaulted non-type template parameters of bool type
David Blaikie [Wed, 1 Apr 2020 20:00:12 +0000 (13:00 -0700)]
DebugInfo: Defaulted non-type template parameters of bool type

Caused an assertion due to mismatched bit widths - this seems like the
right API to use for a possibly width-varying equality test. Though
certainly open to some post-commit review feedback if there's a more
suitable way to do this comparison/test.

4 years ago[intel-pt] Implement a basic test case
Walter Erquinigo [Tue, 31 Mar 2020 00:26:58 +0000 (17:26 -0700)]
[intel-pt] Implement a basic test case

Summary:
Depends on D76872.

There was no test for the Intel PT support on LLDB, so I'm creating one, which
will help making progress on solid grounds.

The test is skipped if the Intel PT plugin library is not built.

Reviewers: clayborg, labath, kusmour, aadsm

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77107

4 years ago[source maps] Ensure all valid source maps are added instead of failing with the...
Walter Erquinigo [Wed, 1 Apr 2020 00:08:40 +0000 (17:08 -0700)]
[source maps] Ensure all valid source maps are added instead of failing with the first invalid one

Summary:
Several lldb-vscode users have noticed that when a source map rule is invalid (because a folder doesn't exist anymore), the rest of the source maps from their configurations are not applied.
This happens because lldb-vscode executes a single "settings set target.source-map" command with all the source maps and LLDB processes them one by one until one fails.

Instead of doing this, we can process in LLDB all the source map rules and apply the valid ones instead of failing fast.

Reviewers: clayborg, labath, kusmour, aadsm

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77186

4 years ago[globalisel][legalizer] Fix DebugLoc bugs caught by a prototype lost-location verifier
Daniel Sanders [Wed, 1 Apr 2020 19:42:23 +0000 (12:42 -0700)]
[globalisel][legalizer] Fix DebugLoc bugs caught by a prototype lost-location verifier

The legalizer has a tendency to lose DebugLoc's when expanding or
combining instructions. The verifier that detected these isn't ready
for upstreaming yet but this patch fixes the cases that came up when
applying it to our out-of-tree backend's CodeGen tests.

This pattern comes up a few more times in this file and probably in
the backends too but I'd prefer to fix the others separately (and
preferably when the lost-location verifier detects them).

4 years ago[ORC] Don't require a null-terminator on MemoryBuffers for objects in archives.
Lang Hames [Wed, 1 Apr 2020 18:36:36 +0000 (11:36 -0700)]
[ORC] Don't require a null-terminator on MemoryBuffers for objects in archives.

The MemoryBuffer::getMemBuffer method's RequiresNullTerminator parameter
defaults to true, but object files are not null terminated so we need to
explicitly pass false here.

4 years ago[ORC] Add JITDylib name to debugging output when defining symbols.
Lang Hames [Wed, 1 Apr 2020 17:16:14 +0000 (10:16 -0700)]
[ORC] Add JITDylib name to debugging output when defining symbols.

4 years ago[libc] Add sigfillset and sigdelset
Alex Brachet [Wed, 1 Apr 2020 19:07:49 +0000 (15:07 -0400)]
[libc] Add sigfillset and sigdelset

Summary: Add's `sigfillset` and `sigdelset` which will be used in D76676.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D76936

4 years ago[InstCombine] enhance freelyNegateValue() by handling xor
Sanjay Patel [Wed, 1 Apr 2020 18:32:13 +0000 (14:32 -0400)]
[InstCombine] enhance freelyNegateValue() by handling xor

Negation is equivalent to bitwise-not + 1, so try to convert more
subtracts into adds using this relationship:
0 - (A ^ C) => ((A ^ C) ^ -1) + 1 => A ^ ~C + 1

I doubt this will recover the regression noted in rGf2fbdf76d8d0,
but seems like we're going to need to improve here and/or revive D68408?

Alive2 proofs:
http://volta.cs.utah.edu:8080/z/Re5tMU
http://volta.cs.utah.edu:8080/z/An-uns

Differential Revision: https://reviews.llvm.org/D77230

4 years ago[InstCombine] add tests for negate with xor operand; NFC
Sanjay Patel [Wed, 1 Apr 2020 16:00:22 +0000 (12:00 -0400)]
[InstCombine] add tests for negate with xor operand; NFC

4 years agoRevert "[OPENMP50]Add initial support for OpenMP 5.0 iterator."
Alexey Bataev [Wed, 1 Apr 2020 18:53:19 +0000 (14:53 -0400)]
Revert "[OPENMP50]Add initial support for OpenMP 5.0 iterator."

This reverts commit f08df464ae89972a777c0a7e299a2c153a9829d8 to fix the
bug with serialization support for iterator expression.

4 years agoFix PR45371: SeparateConstOffsetFromGEP clean up bookkeeping
Jonathan Roelofs [Tue, 31 Mar 2020 19:11:19 +0000 (13:11 -0600)]
Fix PR45371: SeparateConstOffsetFromGEP clean up bookkeeping

find() was altering the UserChain, even in cases where it subsequently
discovered that the resulting constant was a 0. This confuses
rebuildWithoutConstOffset() when it attempts to walk the chain later, since it
is expected that the chain itself be a path down the use-def edges of an
expression.

4 years agoRevert "[InstCombine] Erase old instruction when replacing extractelements"
Nikita Popov [Wed, 1 Apr 2020 18:10:11 +0000 (20:10 +0200)]
Revert "[InstCombine] Erase old instruction when replacing extractelements"

This reverts commit d40368fdb5e1b90e68b1078f32c283aa800238be.

llvm-clang-x86_64-expensive-checks-debian failure looks related.

4 years ago[SimplifyLibCalls] Erase replaced instructions
Nikita Popov [Sun, 29 Mar 2020 17:10:19 +0000 (19:10 +0200)]
[SimplifyLibCalls] Erase replaced instructions

After RAUWing an instruction, also erase it. This makes sure we
don't perform extra InstCombine iterations to clean up the garbage.

4 years ago[NewGVN] Make NewGVN aware of aligned_alloc
Uday Bondhugula [Sat, 28 Mar 2020 07:33:06 +0000 (13:03 +0530)]
[NewGVN] Make NewGVN aware of aligned_alloc

Make the New GVN pass aware of aligned_alloc.

Depends on D76975.

Differential Revision: https://reviews.llvm.org/D76976

4 years ago[GVN] Make GVN aware of aligned_alloc
Uday Bondhugula [Sat, 28 Mar 2020 07:27:35 +0000 (12:57 +0530)]
[GVN] Make GVN aware of aligned_alloc

Make the GVN pass aware of aligned_alloc.

Depends on D76974.

Differential Revision: https://reviews.llvm.org/D76975

4 years ago[Attributor] Make attributor aware of aligned_alloc for heap to stack conversion
Uday Bondhugula [Sat, 28 Mar 2020 07:15:59 +0000 (12:45 +0530)]
[Attributor] Make attributor aware of aligned_alloc for heap to stack conversion

Make the attributor pass aware of aligned_alloc for converting heap
allocations to stack ones.

Depends on D76971.

Differential Revision: https://reviews.llvm.org/D76974

4 years ago[InstCombine] Erase old instruction when replacing extractelements
Nikita Popov [Mon, 30 Mar 2020 20:05:34 +0000 (22:05 +0200)]
[InstCombine] Erase old instruction when replacing extractelements

As we are not returning the result of replaceInstUsesWith(),
so we need to clean up ourselves.

NFC apart from worklist order.

4 years ago[InstCombine] Use replaceOperand() in div transforms
Nikita Popov [Mon, 30 Mar 2020 20:00:16 +0000 (22:00 +0200)]
[InstCombine] Use replaceOperand() in div transforms

To make sure the old operand is DCEd.

NFC apart from worklist order.