platform/upstream/llvm.git
4 years ago[test][Inliner] Make always-inline.ll work with NPM
Arthur Eubanks [Wed, 26 Aug 2020 23:55:46 +0000 (16:55 -0700)]
[test][Inliner] Make always-inline.ll work with NPM

The NPM doesn't support call-site alwaysinline as described in the comments.

Also make NPM runs more similar to legacy PM runs.

Reviewed By: ychen, asbirlea

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

4 years ago[GISel] Add new GISel combiners for G_SELECT
Aditya Nandakumar [Thu, 27 Aug 2020 16:38:48 +0000 (09:38 -0700)]
[GISel] Add new GISel combiners for G_SELECT

https://reviews.llvm.org/D83833

Patch adds two new GICombinerRules for G_SELECT. The rules include:
combining selects with undef comparisons into their first selectee value,
and to combine away selects with constant comparisons. Patch additionally
adds a new combiner test for the AArch64 target to test these new G_SELECT
combiner rules and the existing select_same_val combiner rule.

Patch by  mkitzan

4 years ago[lldb] Make lldb-argdumper a dependency of liblldb
Jonas Devlieghere [Thu, 27 Aug 2020 16:29:47 +0000 (09:29 -0700)]
[lldb] Make lldb-argdumper a dependency of liblldb

Always make lldb-argdumper a dependency of liblldb. Currently it is only
a dependency of the python swig target because of the relative symlink
in the python resource directory. That means that the dependency won't
be there when LLDB_ENABLE_PYTHON is disabled.

Differential revision: https://reviews.llvm.org/D86722

4 years ago[lldb] Move triple construction out of getArchCFlags in DarwinBuilder (NFC)
Jonas Devlieghere [Wed, 26 Aug 2020 18:56:30 +0000 (11:56 -0700)]
[lldb] Move triple construction out of getArchCFlags in DarwinBuilder (NFC)

Move the construction of the triple out of getArchCFlags in the
DarwinBuilder.

4 years ago[OCaml] Remove add_constant_propagation
Arthur Eubanks [Thu, 27 Aug 2020 16:29:17 +0000 (09:29 -0700)]
[OCaml] Remove add_constant_propagation

After https://reviews.llvm.org/D85159.

4 years ago[sda][nfc] clang-formatting
Simon Moll [Thu, 27 Aug 2020 16:22:47 +0000 (18:22 +0200)]
[sda][nfc] clang-formatting

4 years ago[Attributor] Add a phase flag to Attributor
Shinji Okumura [Thu, 27 Aug 2020 16:16:38 +0000 (01:16 +0900)]
[Attributor] Add a phase flag to Attributor

Add a new flag that indicates which stage in the process we are in.
This flag is introduced for handling behavior of `getAAFor` according to the stage. (discussed in D86635)

Reviewed By: jdoerfert

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

4 years ago[GISel]: Fix one more CSE Non determinism
Aditya Nandakumar [Thu, 27 Aug 2020 15:54:33 +0000 (08:54 -0700)]
[GISel]: Fix one more CSE Non determinism

https://reviews.llvm.org/D86676

Sometimes we can have the following code

 x:gpr(s32) = G_OP

Say we build G_OP2 to the same x and then delete the previous instruction. Using something like

 Register X = ...;
 auto NewMIB = CSEBuilder.buildOp2(X, ... args);

Currently there's a mismatch in how NewMIB is profiled and inserted into the CSEMap (ie it doesn't consider register bank/register class along with type).Unify the profiling by refactoring and calling the common method.

This was found by turning on the CSEInfo::verify in at the end of each of our GISel passes which turns inconsistent state/non determinism in CSEing into crashes which likely usually indicates missing calls to Observer on mutations (the most common case). Here non determinism usually means not cseing sometimes, but almost never about producing incorrect code.
Also this patch adds this verification at the end of the combiners as well.

4 years ago[CodeGen] Properly propagating Calling Convention information when lowering vector...
Lucas Prates [Thu, 27 Aug 2020 14:31:40 +0000 (15:31 +0100)]
[CodeGen] Properly propagating Calling Convention information when lowering vector arguments

When joining the legal parts of vector arguments into its original value
during the lower of Formal Arguments in SelectionDAGBuilder, the Calling
Convention information was not being propagated for the handling of each
individual parts. The same did not happen when lowering calls, causing a
mismatch.

This patch fixes the issue by properly propagating the Calling
Convention details.

This fixes Bugzilla #47001.

Reviewed By: arsenm

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

4 years ago[MLIR][GPUToSPIRV] Fix use-after-free. Found by asan.
Benjamin Kramer [Thu, 27 Aug 2020 15:57:11 +0000 (17:57 +0200)]
[MLIR][GPUToSPIRV] Fix use-after-free. Found by asan.

4 years ago[HeapProf] Clang and LLVM support for heap profiling instrumentation
Teresa Johnson [Thu, 13 Aug 2020 23:29:38 +0000 (16:29 -0700)]
[HeapProf] Clang and LLVM support for heap profiling instrumentation

See RFC for background:
http://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html

Note that the runtime changes will be sent separately (hopefully this
week, need to add some tests).

This patch includes the LLVM pass to instrument memory accesses with
either inline sequences to increment the access count in the shadow
location, or alternatively to call into the runtime. It also changes
calls to memset/memcpy/memmove to the equivalent runtime version.
The pass is modeled on the address sanitizer pass.

The clang changes add the driver option to invoke the new pass, and to
link with the upcoming heap profiling runtime libraries.

Currently there is no attempt to optimize the instrumentation, e.g. to
aggregate updates to the same memory allocation. That will be
implemented as follow on work.

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

4 years agoRevert "[libcxx] Fix compile for BUILD_EXTERNAL_THREAD_LIBRARY"
Mikhail Maltsev [Thu, 27 Aug 2020 15:47:18 +0000 (16:47 +0100)]
Revert "[libcxx] Fix compile for BUILD_EXTERNAL_THREAD_LIBRARY"

This reverts commit 3b71f91558ff8b569199547efe800cb501c3cf94.

The commit is breaking some build bots.

4 years ago[InstSimplify][EarlyCSE] Try to CSE PHI nodes in the same basic block
Roman Lebedev [Wed, 26 Aug 2020 08:11:04 +0000 (11:11 +0300)]
[InstSimplify][EarlyCSE] Try to CSE PHI nodes in the same basic block

Apparently, we don't do this, neither in EarlyCSE, nor in InstSimplify,
nor in (old) GVN, but do in NewGVN and SimplifyCFG of all places..

While i could teach EarlyCSE how to hash PHI nodes,
we can't really do much (anything?) even if we find two identical
PHI nodes in different basic blocks, same-BB case is the interesting one,
and if we teach InstSimplify about it (which is what i wanted originally,
https://reviews.llvm.org/D86530), we get EarlyCSE support for free.

So i would think this is pretty uncontroversial.

On vanilla llvm test-suite + RawSpeed, this has the following effects:
```
| statistic name                                     | baseline  | proposed  |      Δ |        % |    \|%\| |
|----------------------------------------------------|-----------|-----------|-------:|---------:|---------:|
| instsimplify.NumPHICSE                             | 0         | 23779     |  23779 |    0.00% |    0.00% |
| asm-printer.EmittedInsts                           | 7942328   | 7942392   |     64 |    0.00% |    0.00% |
| assembler.ObjectBytes                              | 273069192 | 273084704 |  15512 |    0.01% |    0.01% |
| correlated-value-propagation.NumPhis               | 18412     | 18539     |    127 |    0.69% |    0.69% |
| early-cse.NumCSE                                   | 2183283   | 2183227   |    -56 |    0.00% |    0.00% |
| early-cse.NumSimplify                              | 550105    | 542090    |  -8015 |   -1.46% |    1.46% |
| instcombine.NumAggregateReconstructionsSimplified  | 73        | 4506      |   4433 | 6072.60% | 6072.60% |
| instcombine.NumCombined                            | 3640264   | 3664769   |  24505 |    0.67% |    0.67% |
| instcombine.NumDeadInst                            | 1778193   | 1783183   |   4990 |    0.28% |    0.28% |
| instcount.NumCallInst                              | 1758401   | 1758799   |    398 |    0.02% |    0.02% |
| instcount.NumInvokeInst                            | 59478     | 59502     |     24 |    0.04% |    0.04% |
| instcount.NumPHIInst                               | 330557    | 330533    |    -24 |   -0.01% |    0.01% |
| instcount.TotalInsts                               | 8831952   | 8832286   |    334 |    0.00% |    0.00% |
| simplifycfg.NumInvokes                             | 4300      | 4410      |    110 |    2.56% |    2.56% |
| simplifycfg.NumSimpl                               | 1019808   | 999607    | -20201 |   -1.98% |    1.98% |
```
I.e. it fires ~24k times, causes +110 (+2.56%) more `invoke` -> `call`
transforms, and counter-intuitively results in *more* instructions total.

That being said, the PHI count doesn't decrease that much,
and looking at some examples, it seems at least some of them
were previously getting PHI CSE'd in SimplifyCFG of all places..

I'm adjusting `Instruction::isIdenticalToWhenDefined()` at the same time.
As a comment in `InstCombinerImpl::visitPHINode()` already stated,
there are no guarantees on the ordering of the operands of a PHI node,
so if we just naively compare them, we may false-negatively say that
the nodes are not equal when the only difference is operand order,
which is especially important since the fold is in InstSimplify,
so we can't rely on InstCombine sorting them beforehand.

Fixing this for the general case is costly (geomean +0.02%),
and does not appear to catch anything in test-suite, but for
the same-BB case, it's trivial, so let's fix at least that.

As per http://llvm-compile-time-tracker.com/compare.php?from=04879086b44348cad600a0a1ccbe1f7776cc3cf9&to=82bdedb888b945df1e9f130dd3ac4dd3c96e2925&stat=instructions
this appears to cause geomean +0.03% compile time increase (regression),
but geomean -0.01%..-0.04% code size decrease (improvement).

4 years ago[NFC][EarlyCSE][InstSimplify] Add tests for CSE of PHI nodes
Roman Lebedev [Thu, 27 Aug 2020 12:03:53 +0000 (15:03 +0300)]
[NFC][EarlyCSE][InstSimplify] Add tests for CSE of PHI nodes

PHI nodes depend on the block they're in,
so we can only deal with the most basic case of same-BB PHI's.

4 years ago[Test] Tidy up loose ends from LLVM_HAS_GLOBAL_ISEL
Russell Gallop [Thu, 27 Aug 2020 14:50:25 +0000 (15:50 +0100)]
[Test] Tidy up loose ends from LLVM_HAS_GLOBAL_ISEL

This hasn't been allowed as a build option since r309990

Remove leftover REQUIRES: global-isel

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

4 years ago[libc++] Install a more recent CMake on libc++ builders
Louis Dionne [Thu, 27 Aug 2020 15:21:37 +0000 (11:21 -0400)]
[libc++] Install a more recent CMake on libc++ builders

4 years ago[libcxx] Fix compile for BUILD_EXTERNAL_THREAD_LIBRARY
David Nicuesa [Thu, 27 Aug 2020 15:21:35 +0000 (16:21 +0100)]
[libcxx] Fix compile for BUILD_EXTERNAL_THREAD_LIBRARY

Fix compilation with -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY when using clang. Now linking target  'cxx_external_threads' with 'cxx-headers'. Fix mismatching visibility for `libcpp_timed_backoff_policy` function in file <__threading_support>.

Reviewed By: #libc, ldionne

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

4 years ago[CodeGen][AArch64] Support arm_sve_vector_bits attribute
Cullen Rhodes [Tue, 11 Aug 2020 14:30:02 +0000 (14:30 +0000)]
[CodeGen][AArch64] Support arm_sve_vector_bits attribute

This patch implements codegen for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.

VLSTs are represented as VectorType in the AST and fixed-length vectors
in the IR everywhere except in function args/return. Implemented in this
patch is codegen support for the following:

  * Implicit casting between VLA <-> VLS types.
  * Coercion of VLS types in function args/return.
  * Mangling of VLS types.

Casting is handled by the CK_BitCast operation, which has been extended
to support the two new vector kinds for fixed-length SVE predicate and
data vectors, where the cast is implemented through memory rather than a
bitcast which is unsupported. Implementing this as a normal bitcast
would require relaxing checks in LLVM to allow bitcasting between
scalable and fixed types. Another option was adding target-specific
intrinsics, although codegen support would need to be added for these
intrinsics. Given this, casting through memory seemed like the best
approach as it's supported today and existing optimisations may remove
unnecessary loads/stores, although there is room for improvement here.

Coercion of VLSTs in function args/return from fixed to scalable is
implemented through the AArch64 ABI in TargetInfo.

The VLA and VLS types are defined by the ACLE to map to the same
machine-level SVE vectors. VLS types are mangled in the same way as:

  __SVE_VLS<typename, unsigned>

where the first argument is the underlying variable-length type and the
second argument is the SVE vector length in bits. For example:

  #if __ARM_FEATURE_SVE_BITS==512
  // Mangled as 9__SVE_VLSIu11__SVInt32_tLj512EE
  typedef svint32_t vec __attribute__((arm_sve_vector_bits(512)));
  // Mangled as 9__SVE_VLSIu10__SVBool_tLj512EE
  typedef svbool_t pred __attribute__((arm_sve_vector_bits(512)));
  #endif

The latest ACLE specification (00bet5) does not contain details of this
mangling scheme, it will be specified in the next revision.  The
mangling scheme is otherwise defined in the appendices to the Procedure
Call Standard for the Arm Architecture, see [2] for more information.

[1] https://developer.arm.com/documentation/100987/latest
[2] https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#appendix-c-mangling

Reviewed By: efriedma

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

4 years ago[Support] On Windows, add optional support for {rpmalloc|snmalloc|mimalloc}
Alexandre Ganea [Thu, 27 Aug 2020 15:09:20 +0000 (11:09 -0400)]
[Support] On Windows, add optional support for {rpmalloc|snmalloc|mimalloc}

This patch optionally replaces the CRT allocator (i.e., malloc and free) with rpmalloc (mixed public domain licence/MIT licence) or snmalloc (MIT licence) or mimalloc (MIT licence). Please note that the source code for these allocators must be available outside of LLVM's tree.

To enable, use `cmake ... -DLLVM_INTEGRATED_CRT_ALLOC=D:/git/rpmalloc -DLLVM_USE_CRT_RELEASE=MT` where `D:/git/rpmalloc` has already been git clone'd from `https://github.com/mjansson/rpmalloc`. The same applies to snmalloc and mimalloc.

When enabled, the allocator will be embeded (statically linked) into the LLVM tools & libraries. This currently only works with the static CRT (/MT), although using the dynamic CRT (/MD) could potentially work as well in the future.

When enabled, this changes the memory stack from:
  new/delete -> MS VC++ CRT malloc/free -> HeapAlloc -> VirtualAlloc
to:
  new/delete -> {rpmalloc|snmalloc|mimalloc} -> VirtualAlloc

The goal of this patch is to bypass the application's global heap - which is thread-safe thus inducing locking - and instead take advantage of a modern lock-free, thread cache, allocator. On a 6-core Xeon Skylake we observe a 2.5x decrease in execution time when linking a large scale application with LLD and ThinLTO (12 min 20 sec -> 5 min 34 sec), when all hardware threads are being used (using LLD's flag /opt:lldltojobs=all). On a dual 36-core Xeon Skylake with all hardware threads used, we observe a 24x decrease in execution time (1 h 2 min -> 2 min 38 sec) when linking a large application with LLD and ThinLTO. Clang build times also see a decrease in the range 5-10% depending on the configuration.

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

4 years agoRevert "[AIX][XCOFF] emit symbol visibility for xcoff object file."
diggerlin [Thu, 27 Aug 2020 15:07:58 +0000 (11:07 -0400)]
Revert "[AIX][XCOFF] emit symbol visibility for xcoff object file."

This reverts commit a0818689213234d5a078641432d10eccccf61a13.

Based on the Hubert Tong'comment  https://reviews.llvm.org/D84265#inline-799085

4 years ago[MLIR] MemRef Normalization for Dialects
Alexandre E. Eichenberger [Thu, 27 Aug 2020 05:17:33 +0000 (10:47 +0530)]
[MLIR] MemRef Normalization for Dialects

When dealing with dialects that will results in function calls to
external libraries, it is important to be able to handle maps as some
dialects may require mapped data.  Before this patch, the detection of
whether normalization can apply or not, operations are compared to an
explicit list of operations (`alloc`, `dealloc`, `return`) or to the
presence of specific operation interfaces (`AffineReadOpInterface`,
`AffineWriteOpInterface`, `AffineDMAStartOp`, or `AffineDMAWaitOp`).

This patch add a trait, `MemRefsNormalizable` to determine if an
operation can have its `memrefs` normalized.

This trait can be used in turn by dialects to assert that such
operations are compatible with normalization of `memrefs` with
nontrivial memory layout specification. An example is given in the
literal tests.

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

4 years ago[Hexagon] Fold another layer of single-use variable into assert. NFCI.
Benjamin Kramer [Thu, 27 Aug 2020 14:52:34 +0000 (16:52 +0200)]
[Hexagon] Fold another layer of single-use variable into assert. NFCI.

4 years ago[Hexagon] Fold single-use variable into assert. NFCI.
Benjamin Kramer [Thu, 27 Aug 2020 14:40:20 +0000 (16:40 +0200)]
[Hexagon] Fold single-use variable into assert. NFCI.

4 years ago[lldb/cmake] Fix linking of lldbSymbolHelpers for 9cb222e7
Pavel Labath [Thu, 27 Aug 2020 14:36:55 +0000 (16:36 +0200)]
[lldb/cmake] Fix linking of lldbSymbolHelpers for 9cb222e7

I didn't find this locally because I have a /usr/include/gtest which is
similar enough to the bundled one to make things appear to work.

4 years agoAMDGPU: Hoist subtarget lookup
Matt Arsenault [Wed, 12 Aug 2020 12:53:35 +0000 (08:53 -0400)]
AMDGPU: Hoist subtarget lookup

4 years ago[Hexagon] Widen short vector stores to HVX vectors using masked stores
Krzysztof Parzyszek [Thu, 27 Aug 2020 02:00:49 +0000 (21:00 -0500)]
[Hexagon] Widen short vector stores to HVX vectors using masked stores

Also invent a flag -hexagon-hvx-widen=N to set the minimum threshold
for widening short vectors to HVX vectors.

4 years ago[SimplifyLibCalls] Remove over-eager early return in strlen optzns.
Florian Hahn [Thu, 27 Aug 2020 13:13:07 +0000 (14:13 +0100)]
[SimplifyLibCalls] Remove over-eager early return in strlen optzns.

Currently we bail out early for strlen calls with a GEP operand, if none
of the GEP specific optimizations fire. But there could be later
optimizations that still apply,  which we currently miss out on.

An example is that we do not apply the following optimization
   strlen(x) == 0 --> *x == 0

Unless I am missing something, there seems to be no reason for bailing
out early there.

Fixes PR47149.

Reviewed By: lebedev.ri, xbolva00

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

4 years ago[lldb/cmake] Fix linking of lldbUtilityHelpers for 9cb222e74
Pavel Labath [Thu, 27 Aug 2020 14:06:59 +0000 (16:06 +0200)]
[lldb/cmake] Fix linking of lldbUtilityHelpers for 9cb222e74

4 years ago[lldb] Fix Type::GetByteSize for pointer types
Pavel Labath [Mon, 24 Aug 2020 09:20:25 +0000 (11:20 +0200)]
[lldb] Fix Type::GetByteSize for pointer types

The function was returning an incorrect (empty) value on the first
invocation. Given that this only affected the first invocation, this
bug/typo went mostly unaffected. DW_AT_const_value were particularly
badly affected by this as the GetByteSize call is
SymbolFileDWARF::ParseVariableDIE is likely to be the first call of this
function, and its effects cannot be undone by retrying.

Depends on D86348.

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

4 years ago[cmake] Make gtest include directories a part of the library interface
Pavel Labath [Wed, 12 Aug 2020 10:02:37 +0000 (12:02 +0200)]
[cmake] Make gtest include directories a part of the library interface

This applies the same fix that D84748 did for macro definitions.
Appropriate include path is now automatically set for all libraries
which link against gtest targets, which avoids the need to set
include_directories in various parts of the project.

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

4 years ago[Tooling][Format] Treat compound extensions (foo.bar.cc) as matching foo.h
Sam McCall [Wed, 26 Aug 2020 08:33:25 +0000 (10:33 +0200)]
[Tooling][Format] Treat compound extensions (foo.bar.cc) as matching foo.h

Motivating use case is ".cu.cc" extensions used in some bazel projects.

Alternative is to work around this with IncludeIsMainRegex in styles.
I proposed this approach because it seems like a better default.

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

4 years ago[lldb/DWARF] Fix handling of variables with both location and const_value attributes
Pavel Labath [Wed, 26 Aug 2020 12:13:54 +0000 (14:13 +0200)]
[lldb/DWARF] Fix handling of variables with both location and const_value attributes

Class-level static constexpr variables can have both DW_AT_const_value
(in the "declaration") and a DW_AT_location (in the "definition")
attributes. Our code was trying to handle this, but it was brittle and
hard to follow (and broken) because it was processing the attributes in
the order in which they were found.

Refactor the code to make the intent clearer -- DW_AT_location trumps
DW_AT_const_value, and fix the bug which meant that we were not
displaying these variables properly (the culprit was the delayed parsing
of the const_value attribute due to a need to fetch the variable type.

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

4 years ago[lldb/Utility] Use APSInt in the Scalar class
Pavel Labath [Mon, 24 Aug 2020 12:03:17 +0000 (14:03 +0200)]
[lldb/Utility] Use APSInt in the Scalar class

This enables us to further simplify some code because it no longer needs
to switch on the signedness of the type (APSInt handles that).

4 years agoFix OpenMP deduplicateRuntimeCalls return status
serge-sans-paille [Thu, 27 Aug 2020 12:34:54 +0000 (14:34 +0200)]
Fix OpenMP deduplicateRuntimeCalls return status

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

4 years agoFix Attributor return status
serge-sans-paille [Thu, 27 Aug 2020 12:34:32 +0000 (14:34 +0200)]
Fix Attributor return status

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

4 years ago[SyntaxTree][NFC][Style] Functions start with lowercase
Eduardo Caldas [Thu, 27 Aug 2020 06:00:44 +0000 (06:00 +0000)]
[SyntaxTree][NFC][Style] Functions start with lowercase

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

4 years ago[SyntaxTree][NFC] Append "get" to syntax Nodes accessor names
Eduardo Caldas [Thu, 27 Aug 2020 05:41:26 +0000 (05:41 +0000)]
[SyntaxTree][NFC] Append "get" to syntax Nodes accessor names

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

4 years ago[CMake][compiler-rt][libunwind] Compile assembly files as ASM not C, unify workarounds
Raul Tambre [Thu, 20 Aug 2020 17:17:47 +0000 (20:17 +0300)]
[CMake][compiler-rt][libunwind] Compile assembly files as ASM not C, unify workarounds

It isn't very wise to pass an assembly file to the compiler and tell it to compile as a C file and hope that the compiler recognizes it as assembly instead.
Simply don't mark the file as C and CMake will recognize the rest.

This was attempted earlier in https://reviews.llvm.org/D85706, but reverted due to architecture issues on Apple.
Subsequent digging revealed a similar change was done earlier for libunwind in https://reviews.llvm.org/rGb780df052dd2b246a760d00e00f7de9ebdab9d09.
Afterwards workarounds were added for MinGW and Apple:
* https://reviews.llvm.org/rGb780df052dd2b246a760d00e00f7de9ebdab9d09
* https://reviews.llvm.org/rGd4ded05ba851304b26a437896bc3962ef56f62cb

The workarounds in libunwind and compiler-rt are unified and comments added pointing to each other.
The workaround is updated to only be used for MinGW for CMake versions before 3.17, which fixed the issue (https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4287).

Additionally fixed Clang not being passed as the assembly compiler for compiler-rt runtime build.

Example error:
[525/634] Building C object lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
FAILED: lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
/opt/tooling/drive/host/bin/clang --target=aarch64-linux-gnu -I/opt/tooling/drive/llvm/compiler-rt/lib/tsan/.. -isystem /opt/tooling/drive/toolchain/opt/drive/toolchain/include -x c -Wall -Wno-unused-parameter -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fPIE -fno-rtti -Wframe-larger-than=530 -Wglobal-constructors --sysroot=. -MD -MT lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -MF lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o.d -o lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -c /opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
/opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S:29:1: error: expected identifier or '('
.section .text
^
1 error generated.

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

4 years ago[AMDGPU] Remove unused variable introduced in r251860
Jay Foad [Wed, 26 Aug 2020 16:06:54 +0000 (17:06 +0100)]
[AMDGPU] Remove unused variable introduced in r251860

4 years ago[FPEnv] Allow fneg + strict_fadd -> strict_fsub in DAGCombiner
Drew Wock [Wed, 26 Aug 2020 19:17:17 +0000 (15:17 -0400)]
[FPEnv] Allow fneg + strict_fadd -> strict_fsub in DAGCombiner

This is the first of a set of DAGCombiner changes enabling strictfp
optimizations. I want to test to waters with this to make sure changes
like these are acceptable for the strictfp case- this particular change
should preserve exception ordering and result precision perfectly, and
many other possible changes appear to be able to as well.

Copied from regular fadd combines but modified to preserve ordering via
the chain, this change allows strict_fadd x, (fneg y) to become
struct_fsub x, y and strict_fadd (fneg x), y to become strict_fsub y, x.

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

4 years ago[LLD] [COFF] Check the aux section definition size for IMAGE_COMDAT_SELECT_SAME_SIZE
Martin Storsjö [Wed, 26 Aug 2020 12:47:04 +0000 (15:47 +0300)]
[LLD] [COFF] Check the aux section definition size for IMAGE_COMDAT_SELECT_SAME_SIZE

Binutils generated sections seem to be padded to a multiple of 16 bytes,
but the aux section definition contains the original, unpadded section
length.

The size check used for IMAGE_COMDAT_SELECT_SAME_SIZE previously
only checked the size of the section itself. When checking the
currently processed object file against the previously chosen
comdat section, we easily have access to the aux section definition
of the currently processed section, but we have to iterate over the
symbols of the previously selected object file to find the section
definition of the previously picked section. (We don't want to
inflate SectionChunk to carry more data, for something that is only
needed in corner cases.) Only do this when the mingw flag is set.

This fixes statically linking clang-built C++ object files against
libstdc++ built with GCC, if the object files contain e.g. typeinfo.

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

4 years ago[LLD] [MinGW] Enable dynamicbase by default
Martin Storsjö [Wed, 26 Aug 2020 13:02:52 +0000 (16:02 +0300)]
[LLD] [MinGW] Enable dynamicbase by default

This matches lld-link's own default.

Add a new command line option --no-dynamicbase for disabling it.
(Unfortunately, GNU ld doesn't yet have a matching --no-dynamicbase
option, as that's the default there.)

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

4 years agoFix for PS4 bots after 0b7f6cc71a72a85f8a0cbee836a7a8e31876951a
Russell Gallop [Thu, 27 Aug 2020 11:46:49 +0000 (12:46 +0100)]
Fix for PS4 bots after 0b7f6cc71a72a85f8a0cbee836a7a8e31876951a

4 years ago[DSE,MemorySSA] Remove short-cut to check if all paths are covered.
Florian Hahn [Thu, 27 Aug 2020 11:39:22 +0000 (12:39 +0100)]
[DSE,MemorySSA] Remove short-cut to check if all paths are covered.

The post-order number early continue does not work in some cases, e.g.
if a path from EarlierAccess to an exit includes a node that dominates
EarlierAccess in a cycle.

The short-cut only has very minor impact on compile-time, so it seems
straight-forward to remove it for now:

http://llvm-compile-time-tracker.com/compare.php?from=062412e79fcfedf2cf004433e42036b0333e3f83&to=d7386016a77ce1387bdbbf360f1de157faea9d31&stat=instructions

Fixes PR47285.

4 years ago[NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file
Anatoly Trosinenko [Thu, 27 Aug 2020 10:19:08 +0000 (13:19 +0300)]
[NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file

The existing implementations are almost identical except for width of the
integer type.

Factor them out to int_mulo_impl.inc for better maintainability.

This patch is almost identical to D86277.

Reviewed By: MaskRay

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

4 years ago[NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file
Anatoly Trosinenko [Thu, 27 Aug 2020 10:19:00 +0000 (13:19 +0300)]
[NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file

The existing implementations are almost identical except for width of the
integer type.

Factor them out to int_mulv_impl.inc for better maintainability.

Reviewed By: MaskRay

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

4 years ago[ELF][test] Add test coverage of TLS to gc-sections.s
Andrew Ng [Wed, 26 Aug 2020 16:06:41 +0000 (17:06 +0100)]
[ELF][test] Add test coverage of TLS to gc-sections.s

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

4 years agoRevert "[DWARF] Add cuttoff guarding quadratic validThroughout behaviour"
OCHyams [Thu, 27 Aug 2020 09:38:28 +0000 (10:38 +0100)]
Revert "[DWARF] Add cuttoff guarding quadratic validThroughout behaviour"

This reverts commit b9d977b0ca60c54f11615ca9d144c9f08b29fd85.

This cutoff is no longer required. The commit 34ffa7fc501 (D86153) introduces a
performance improvement which was tested against the motivating case for this
patch.

Discussed in differential revision: https://reviews.llvm.org/D86153

4 years ago[DwarfDebug] Improve validThroughout performance (4/4)
OCHyams [Thu, 27 Aug 2020 08:40:53 +0000 (09:40 +0100)]
[DwarfDebug] Improve validThroughout performance (4/4)

Almost NFC (see end).

The backwards scan in validThroughout significantly contributed to compile time
for a pathological case, causing the 'X86 Assembly Printer' pass to account for
roughly 70% of the run time. This patch guards the loop against running
unnecessarily, bringing the pass contribution down to 4%.

Almost NFC: There is a hack in validThroughout which promotes single constant
value DBG_VALUEs in the prologue to be live throughout the function. We're more
likely to hit this code path with this patch applied. Similarly to the parent
patches there is a small coverage change reported in the order of 10s of bytes.

Reviewed By: aprantl

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

4 years ago[DwarfDebug] Improve multi-BB single location detection in validThroughout (3/4)
OCHyams [Thu, 27 Aug 2020 08:40:52 +0000 (09:40 +0100)]
[DwarfDebug] Improve multi-BB single location detection in validThroughout (3/4)

With the changes introduced in D86151 we can now check for single locations
which span multiple blocks for inlined scopes and blocks.

D86151 introduced the InstructionOrdering parameter, replacing a scan through
MBB instructions. The functionality to compare instruction positions across
blocks was add there, and this patch just removes the exit checks that were
previously (but no longer) required.

CTMark shows a geomean binary size reduction of 2.2% for RelWithDebInfo builds.
llvm-locstats (using D85636) shows a very small variable location coverage
change in 5 of 10 binaries, but just like in D86151 it is only in the order of
10s of bytes.

Reviewed By: djtodoro

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

4 years ago[DwarfDebug] Improve single location detection in validThroughout (2/4)
OCHyams [Thu, 27 Aug 2020 08:40:50 +0000 (09:40 +0100)]
[DwarfDebug] Improve single location detection in validThroughout (2/4)

With this patch we're now accounting for two more cases which should be
considered 'valid throughout': First, where RangeEnd is ScopeEnd. Second, where
RangeEnd comes before ScopeEnd when including meta instructions, but are both
preceded by the same non-meta instruction.

CTMark shows a geomean binary size reduction of 1.5% for RelWithDebInfo builds.
`llvm-locstats` (using D85636) shows a very small variable location coverage
change in 2 of 10 binaries, but it is in the order of 10s of bytes which lines
up with my expectations.

I've added a test which checks both of these new cases. The first check in the
test isn't strictly necessary for this patch. But I'm not sure that it is
explicitly tested anywhere else, and is useful for the final patch in the
series.

Reviewed By: aprantl

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

4 years ago[NFC][DebugInfo] Create InstructionOrdering helper class (1/4)
OCHyams [Thu, 27 Aug 2020 08:40:48 +0000 (09:40 +0100)]
[NFC][DebugInfo] Create InstructionOrdering helper class (1/4)

Group the map and methods used to query instruction ordering for trimVarLocs
(D82129) into a class. This will make it easier to reuse the functionality
upcoming patches.

Reviewed By: aprantl

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

4 years ago[Sema][AArch64] Support arm_sve_vector_bits attribute
Cullen Rhodes [Tue, 11 Aug 2020 13:04:21 +0000 (13:04 +0000)]
[Sema][AArch64] Support arm_sve_vector_bits attribute

This patch implements the semantics for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.

The semantics were already implemented by D83551, although the
implementation approach has since changed to represent VLSTs as
VectorType in the AST and fixed-length vectors in the IR everywhere
except in function args/returns. This is described in the prototype
patch D85128 demonstrating the new approach.

The semantic changes added in D83551 are changed since the
AttributedType is replaced by VectorType in the AST. Minimal changes
were necessary in the previous patch as the canonical type for both VLA
and VLS was the same (i.e. sizeless), except in constructs such as
globals and structs where sizeless types are unsupported. This patch
reverts the changes that permitted VLS types that were represented as
sizeless types in such circumstances, and adds support for implicit
casting between VLA <-> VLS types as described in section 3.7.3.2 of the
ACLE.

Since the SVE builtin types for bool and uint8 are both represented as
BuiltinType::UChar in VLSTs, two new vector kinds are implemented to
distinguish predicate and data vectors.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: aaron.ballman

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

4 years ago[DSE,MemorySSA] Add test for PR47285.
Florian Hahn [Thu, 27 Aug 2020 10:01:20 +0000 (11:01 +0100)]
[DSE,MemorySSA] Add test for PR47285.

4 years ago[NFC][ValueTracking] Cleanup a test
Vitaly Buka [Thu, 27 Aug 2020 10:24:21 +0000 (03:24 -0700)]
[NFC][ValueTracking] Cleanup a test

4 years ago[AArch64] Optimize instruction selection for certain vector shuffles
Mikhail Maltsev [Thu, 27 Aug 2020 10:06:45 +0000 (11:06 +0100)]
[AArch64] Optimize instruction selection for certain vector shuffles

This patch adds code to recognize vector shuffles which can be
represented as VDUP (splat) of a vector lane with of a different
(wider) type than the original vector lane type.

For example:
    shufflevector <4 x i16> %v, <4 x i16> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
is essentially:
    shufflevector <2 x i32> %v, <2 x i32> undef, <2 x i32> <i32 0, i32 0>

Such patterns are generated by the SelectionDAG machinery in some cases
(see DAGCombiner::visitBITCAST in DAGCombiner.cpp, the "Remove double
bitcasts from shuffles" part).

Reviewed By: dmgreen

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

4 years ago[NFC][ValueTracking] Fix typo in test
Vitaly Buka [Thu, 27 Aug 2020 10:00:56 +0000 (03:00 -0700)]
[NFC][ValueTracking] Fix typo in test

4 years ago[SVE] Fallback to default expansion when lowering SIGN_EXTEN_INREG from non-byte...
Paul Walker [Sat, 22 Aug 2020 11:00:18 +0000 (12:00 +0100)]
[SVE] Fallback to default expansion when lowering SIGN_EXTEN_INREG from non-byte based source.

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

4 years ago[AArch64][SVE] Add missing debug info for ACLE types.
Sander de Smalen [Thu, 27 Aug 2020 07:12:43 +0000 (08:12 +0100)]
[AArch64][SVE] Add missing debug info for ACLE types.

This patch adds type information for SVE ACLE vector types,
by describing them as vectors, with a lower bound of 0, and
an upper bound described by a DWARF expression using the
AArch64 Vector Granule register (VG), which contains the
runtime multiple of 64bit granules in an SVE vector.

Reviewed By: efriedma

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

4 years agoFollow up of rGca243b07276a: fixed a typo. NFC.
Sjoerd Meijer [Thu, 27 Aug 2020 09:50:51 +0000 (10:50 +0100)]
Follow up of rGca243b07276a: fixed a typo. NFC.

4 years ago[lld][ELF][test] Expand testing of symbols in mergeable sections
James Henderson [Tue, 25 Aug 2020 14:54:34 +0000 (15:54 +0100)]
[lld][ELF][test] Expand testing of symbols in mergeable sections

Whilst reviewing some internal testing, I noticed a couple of holes in
coverage of mergeable sections containing symbols. This patch addresses
these holes:
1) Show that mid-piece symbols have their values updated properly when
   pieces are merged.
2) Show the behaviour of symbols in mergeable pieces when --gc-sections
   is enabled.

Reviewed by: grimar, MaskRay

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

4 years ago[RISC-V] fmv.s/fmv.d should be as cheap as a move
Alex Richardson [Tue, 25 Aug 2020 14:45:24 +0000 (15:45 +0100)]
[RISC-V] fmv.s/fmv.d should be as cheap as a move

Since the canonical floatig-point move is fsgnj rd, rs, rs, we should
handle this case in RISCVInstrInfo::isAsCheapAsAMove().

Reviewed By: lenary

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

4 years ago[RISC-V] Mark C_MV as a move instruction
Alex Richardson [Tue, 25 Aug 2020 14:45:06 +0000 (15:45 +0100)]
[RISC-V] Mark C_MV as a move instruction

Reviewed By: luismarques

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

4 years ago[RISC-V] ADDI/ORI/XORI x, 0 should be as cheap as a move
Alex Richardson [Tue, 25 Aug 2020 14:44:57 +0000 (15:44 +0100)]
[RISC-V] ADDI/ORI/XORI x, 0 should be as cheap as a move

The isTriviallyRematerializable hook is only called for instructions that are
tagged as isAsCheapAsAMove. Since ADDI 0 is used for "mv" it should definitely
be marked with "isAsCheapAsAMove". This change avoids one stack spill in most of
the atomic-rmw.ll tests functions. It also avoids stack spills in two of our
out-of-tree CHERI tests.
ORI/XORI with zero may or may not be the same as a move micro-architecturally,
but since we are already doing it for register == x0, we might as well
do the same if the immediate is zero.

Reviewed By: luismarques

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

4 years ago[lldb] Fix gcc 5.4.0 compile error
David Spickett [Wed, 26 Aug 2020 15:25:05 +0000 (16:25 +0100)]
[lldb] Fix gcc 5.4.0 compile error

Specify type when constructing PromotionKeys,
this fixes error:
"chosen constructor is explicit in copy-initialization"
when compiling lldb with GCC 5.4.0.

This is due to std::tuple having an explicit
default constructor, see:
http://cplusplus.github.io/LWG/lwg-defects.html#2193

Reviewed By: labath

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

4 years ago[ValueTracking] Support select in findAllocaForValue
Vitaly Buka [Thu, 27 Aug 2020 09:01:26 +0000 (02:01 -0700)]
[ValueTracking] Support select in findAllocaForValue

4 years ago[unittests/Object] - Simplify the code in ELFObjectFileTest.cpp, NFCI.
Georgii Rymar [Wed, 26 Aug 2020 14:32:45 +0000 (17:32 +0300)]
[unittests/Object] - Simplify the code in ELFObjectFileTest.cpp, NFCI.

This refactors/rewrites the code to remove duplication.

Differential revision: https://reviews.llvm.org/D86623

4 years ago[DSE,MemorySSA] Traverse use-def chain without MemSSA Walker.
Florian Hahn [Thu, 27 Aug 2020 08:52:19 +0000 (09:52 +0100)]
[DSE,MemorySSA] Traverse use-def chain without MemSSA Walker.

For DSE with MemorySSA it is beneficial to manually traverse the
defining access, instead of using a MemorySSA walker, so we can
better control the number of steps together with other limits and
also weed out invalid/unprofitable paths early on.

This patch requires a follow-up patch to be most effective, which I will
share soon after putting this patch up.

This temporarily XFAIL's the limit tests, because we now explore more
MemoryDefs that may not alias/clobber the killing def. This will be
improved/fixed by the follow-up patch.

This patch also renames some `Dom*` variables to `Earlier*`, because the
dominance relation is not really used/important here and potentially
confusing.

This patch allows us to aggressively cut down compile time, geomean
-O3 -0.64%, ReleaseThinLTO -1.65%, at the expense of fewer stores
removed. Subsequent patches will increase the number of removed stores
again, while keeping compile-time in check.

http://llvm-compile-time-tracker.com/compare.php?from=d8e3294118a8c5f3f97688a704d5a05b67646012&to=0a929b6978a068af8ddb02d0d4714a2843dd8ba9&stat=instructions

Reviewed By: asbirlea

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

4 years ago[polly][cmake] Don't build LLVMPolly.so without PIC
Rainer Orth [Thu, 27 Aug 2020 08:59:51 +0000 (10:59 +0200)]
[polly][cmake] Don't build LLVMPolly.so without PIC

A build on `sparcv9-sun-solaris2.11` with `-DLLVM_ENABLE_PIC=Off` failed
linking `LLVMPolly.so`:

  [2277/2297] Linking CXX shared module lib/LLVMPolly.so
  FAILED: lib/LLVMPolly.so
  [...]
  ld: fatal: relocation error: R_SPARC_H44: file tools/polly/lib/CMakeFiles/obj.Polly.dir/Analysis/DependenceInfo.cpp.o: symbol .data._ZL16__gthread_active (section): invalid shared object relocation type: ABS44 code model unsupported
  [...]

As on many other targets, one cannot link non-PIC objects into a shared
object on Solaris/sparcv9.

The following patch avoids this by not building the library without PIC.
It allowed the build to finish.

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

4 years ago[NFC] Add unittests for findAllocaForValue
Vitaly Buka [Thu, 27 Aug 2020 08:49:15 +0000 (01:49 -0700)]
[NFC] Add unittests for findAllocaForValue

4 years agoRevert "[Verifier] Additional check for intrinsic get.active.lane.mask"
Sjoerd Meijer [Thu, 27 Aug 2020 07:59:27 +0000 (08:59 +0100)]
Revert "[Verifier] Additional check for intrinsic get.active.lane.mask"

This reverts commit 8d5f64c4edbc190a5a8790157fa1d99cfac34016.

Thanks to Eli Friedma for pointing out that this check is not appropiate here,
this check will be moved to the Lint pass.

4 years ago[AMDGPU] Preserve vcc_lo when shrinking V_CNDMASK
Piotr Sobczak [Tue, 25 Aug 2020 09:39:01 +0000 (11:39 +0200)]
[AMDGPU] Preserve vcc_lo when shrinking V_CNDMASK

There is no justification for changing vcc_lo to vcc
when shrinking V_CNDMASK, and such a change could
later confuse live variable analysis.

Make sure the original register is preserved.

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

4 years ago[MLIR][Shape] Fix typo
Frederik Gossen [Wed, 26 Aug 2020 10:00:43 +0000 (10:00 +0000)]
[MLIR][Shape] Fix typo

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

4 years ago[LangRef] get.active.lane.mask can produce poison value
Sjoerd Meijer [Wed, 26 Aug 2020 16:23:22 +0000 (17:23 +0100)]
[LangRef] get.active.lane.mask can produce poison value

We had already specified that second argument `n` of this intrinsic is `n > 0`,
but now add to this that the result is a poison value if this is not the case.

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

4 years ago[Attributor] Add flag for undef value to the state of AAPotentialValues
Shinji Okumura [Thu, 27 Aug 2020 07:30:29 +0000 (16:30 +0900)]
[Attributor] Add flag for undef value to the state of AAPotentialValues

Currently, an undef value is reduced to 0 when it is added to a set of potential values.
This patch introduces a flag for under values. By this, for example, we can merge two states `{undef}`, `{1}` to `{1}` (because we can reduce the undef to 1).

Reviewed By: jdoerfert

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

4 years ago[ARM] Enable outliner at -Oz for M-class
Sam Parker [Thu, 27 Aug 2020 06:14:33 +0000 (07:14 +0100)]
[ARM] Enable outliner at -Oz for M-class

Enable default outlining when the function has the minsize attribute
and we're targeting an m-class core.

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

4 years agoRevert "Reapply D70800: Fix AArch64 AAPCS frame record chain"
Martin Storsjö [Thu, 27 Aug 2020 06:25:43 +0000 (09:25 +0300)]
Revert "Reapply D70800: Fix AArch64 AAPCS frame record chain"

This reverts commit 9936455204fd6ab72715cc9d67385ddc93e072ed.

That commit caused failed assertions e.g. like this:

$ cat alloca.c
a;
b() {
  float c;
  d();
  a = __builtin_alloca(d);
  c = e();
  f(a);
  return c;
}
$ clang -target aarch64-linux-gnu -c alloca.c -O2
clang: ../lib/Target/AArch64/AArch64InstrInfo.cpp:3446: void
llvm::emitFrameOffset(llvm::MachineBasicBlock&,
llvm::MachineBasicBlock::iterator, const llvm::DebugLoc&, unsigned int,
unsigned int, llvm::StackOffset, const llvm::TargetInstrInfo*,
llvm::MachineInstr::MIFlag, bool, bool, bool*):
Assertion `(DestReg != AArch64::SP || Bytes % 16 == 0) &&
"SP increment/decrement not 16-byte aligned"' failed.

4 years ago[mlir] NFC: fix trivial typo under test and tools
Kazuaki Ishizaki [Thu, 27 Aug 2020 06:37:23 +0000 (15:37 +0900)]
[mlir] NFC: fix trivial typo under test and tools

Reviewed By: rriddle

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

4 years ago[MLIR][GPUToSPIRV] Passing gpu module name to SPIR-V module
George Mitenkov [Thu, 27 Aug 2020 05:50:57 +0000 (08:50 +0300)]
[MLIR][GPUToSPIRV] Passing gpu module name to SPIR-V module

This patch allows to pass the gpu module name to SPIR-V
module during conversion. This has many benefits as we can lookup
converted to SPIR-V kernel in the symbol table.

In order to avoid symbol conflicts, `"__spv__"` is added to the
gpu module name to form the new one.

Reviewed By: mravishankar

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

4 years ago[RISCV] add the MC layer support of riscv vector Zvamo extension
luxufan [Fri, 31 Jul 2020 05:03:57 +0000 (13:03 +0800)]
[RISCV] add the MC layer support of riscv vector Zvamo extension

Implements the assemble and disassemble support of RISCV Vector
extension zvamo instructions, base on the 0.9 spec version.

Reviewed  by HsiangKai

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

4 years ago[ARM] Make MachineVerifier more strict about terminators
Sam Parker [Thu, 27 Aug 2020 06:09:25 +0000 (07:09 +0100)]
[ARM] Make MachineVerifier more strict about terminators

Fix the ARM backend's analyzeBranch so it doesn't ignore predicated
return instructions, and make the MachineVerifier rule more strict.

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

4 years ago[gn build] Port cf918c809bb
LLVM GN Syncbot [Thu, 27 Aug 2020 05:59:55 +0000 (05:59 +0000)]
[gn build] Port cf918c809bb

4 years ago[gn build] Port 7394460d875
LLVM GN Syncbot [Thu, 27 Aug 2020 05:59:55 +0000 (05:59 +0000)]
[gn build] Port 7394460d875

4 years ago[lld-macho] Fix objc.s test
Jez Ng [Thu, 27 Aug 2020 05:58:47 +0000 (22:58 -0700)]
[lld-macho] Fix objc.s test

Summary: It was passing on my local machine due to previously-written
files cached in the test output folder.

4 years ago[MLIR][SPIRVToLLVM] Added a hook for descriptor set / binding encoding
George Mitenkov [Thu, 27 Aug 2020 05:25:52 +0000 (08:25 +0300)]
[MLIR][SPIRVToLLVM] Added a hook for descriptor set / binding encoding

This patch introduces a hook to encode descriptor set
and binding number into `spv.globalVariable`'s symbolic name. This
allows to preserve this information, and at the same time legalize
the global variable for the conversion to LLVM dialect.

This is required for `mlir-spirv-cpu-runner` to convert kernel
arguments into LLVM.

Also, a couple of some nits added:
- removed unused comment
- changed to a capital letter in the comment

Reviewed By: mravishankar

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

4 years ago[SyntaxTree] Refactor `NodeRole`s
Eduardo Caldas [Wed, 26 Aug 2020 16:18:55 +0000 (16:18 +0000)]
[SyntaxTree] Refactor `NodeRole`s

Previously a NodeRole would generally be prefixed with the `NodeKind`,
we remove this prefix, as it we redundant and made tests more noisy.

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

4 years agoDefault to -fuse-init-array on OpenBSD.
Brad Smith [Thu, 27 Aug 2020 05:12:16 +0000 (01:12 -0400)]
Default to -fuse-init-array on OpenBSD.

4 years ago[NFC][Test] Update the test with utils/update_llc_test_checks.py
QingShan Zhang [Thu, 27 Aug 2020 05:02:16 +0000 (05:02 +0000)]
[NFC][Test] Update the test with utils/update_llc_test_checks.py

4 years agoRemove the `run` method from `OpPassManager` and `Pass` and migrate it to `OpToOpPass...
Mehdi Amini [Thu, 27 Aug 2020 04:42:38 +0000 (04:42 +0000)]
Remove the `run` method from `OpPassManager` and `Pass` and migrate it to `OpToOpPassAdaptor`

This makes OpPassManager more of a "container" of passes and not responsible to drive the execution.
As such we also make it constructible publicly, which will allow to build arbitrary pipeline decoupled from the execution. We'll make use of this facility to expose "dynamic pipeline" in the future.

Reviewed By: rriddle

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

4 years ago[MLIR][SPIRVToLLVM] Updated the documentation for type conversion
George Mitenkov [Thu, 27 Aug 2020 04:47:13 +0000 (07:47 +0300)]
[MLIR][SPIRVToLLVM] Updated the documentation for type conversion

This patch updates the type conversion section of the documentation.
It includes the modelling of array strides and the mapping of the
naturally padded structs.

Reviewed By: mravishankar

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

4 years agoFix an overflow issue at BackpatchWord
Jianzhou Zhao [Wed, 26 Aug 2020 17:52:06 +0000 (17:52 +0000)]
Fix an overflow issue at BackpatchWord

This happens when generating a huge file by LTO, for example, with -gmlt.
When BitNo is > 2^35, ByteNo is overflowed, and an incorrect output offset is overwritten.
This generates ill-formed bitcodes.

Reviewed-by: tejohnson, vitalybuka
Differential Revision: https://reviews.llvm.org/D86645

4 years ago[MLIR][SPIRV] Added optional name to SPIR-V module
George Mitenkov [Thu, 27 Aug 2020 04:10:14 +0000 (07:10 +0300)]
[MLIR][SPIRV] Added optional name to SPIR-V module

This patch adds an optional name to SPIR-V module.
This will help with lowering from GPU dialect (so that we
can pass the kernel module name) and will be more naturally
aligned with `GPUModuleOp`/`ModuleOp`.

Reviewed By: mravishankar

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

4 years ago[PowerPC] Implement Vector Multiply High/Divide Extended Builtins in LLVM/Clang
Amy Kwan [Thu, 27 Aug 2020 03:43:11 +0000 (22:43 -0500)]
[PowerPC] Implement Vector Multiply High/Divide Extended Builtins in LLVM/Clang

This patch implements the function prototypes vec_mulh and vec_dive in order to
utilize the vector multiply high (vmulh[s|u][w|d]) and vector divide extended
(vdive[s|u][w|d]) instructions introduced in Power10.

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

4 years agoFix MLIR build with MLIR_INCLUDE_TESTS=OFF
Ni Hui [Thu, 27 Aug 2020 04:01:23 +0000 (04:01 +0000)]
Fix MLIR build with MLIR_INCLUDE_TESTS=OFF

error message

/usr/bin/ld: CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o: in function `main':
mlir-opt.cpp:(.text.startup.main+0xb9): undefined reference to `mlir::registerTestDialect(mlir::DialectRegistry&)'

Reviewed By: mehdi_amini

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

4 years ago[lld-macho] Implement -all_load
Jez Ng [Wed, 26 Aug 2020 03:00:42 +0000 (20:00 -0700)]
[lld-macho] Implement -all_load

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

4 years ago[lld-macho] Implement weak bindings for GOT/TLV
Jez Ng [Tue, 25 Aug 2020 04:57:59 +0000 (21:57 -0700)]
[lld-macho] Implement weak bindings for GOT/TLV

Previously, we were only emitting regular bindings to weak
dynamic symbols; this diff adds support for the weak bindings too, which
can overwrite the regular bindings at runtime. We also treat weak
defined global symbols similarly -- since they can also be interposed at
runtime, they need to be treated as potentially dynamic symbols.

Note that weak bindings differ from regular bindings in that they do not
specify the dylib to do the lookup in (i.e. weak symbol lookup happens
in a flat namespace.)

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

4 years ago[lld-macho][NFC] Handle GOT bindings and regular bindings more uniformly
Jez Ng [Thu, 20 Aug 2020 21:45:51 +0000 (14:45 -0700)]
[lld-macho][NFC] Handle GOT bindings and regular bindings more uniformly

Previously, the BindingEntry struct could only store bindings to offsets
within InputSections. Since the GOTSection and TLVPointerSections are
OutputSections, I handled those in a separate code path. However, this
makes it awkward to support weak bindings properly without code
duplication. This diff allows BindingEntries to point directly to
OutputSections, simplifying the upcoming weak binding implementation.

Along the way, I also converted a bunch of functions taking references
to symbols to take pointers instead. Given how much casting we do for
Symbol (especially in the upcoming weak binding diffs), it's cleaner
this way.

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

4 years ago[lld-macho] Implement -ObjC
Jez Ng [Tue, 18 Aug 2020 21:37:04 +0000 (14:37 -0700)]
[lld-macho] Implement -ObjC

It's roughly like -force_load with some filtering.

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

4 years ago[lld-macho] Handle TAPI and regular re-exports uniformly
Jez Ng [Thu, 13 Aug 2020 20:48:47 +0000 (13:48 -0700)]
[lld-macho] Handle TAPI and regular re-exports uniformly

The re-exports list in a TAPI document can either refer to other inlined
TAPI documents, or to on-disk files (which may themselves be TBD or
regular files.) Similarly, the re-exports of a regular dylib can refer
to a TBD file.

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

4 years ago[lld-macho] Make it possible to re-export .tbd files
Jez Ng [Tue, 18 Aug 2020 22:46:21 +0000 (15:46 -0700)]
[lld-macho] Make it possible to re-export .tbd files

Two things needed fixing for that to work:

1. getName() no longer returns null for DylibFiles constructed from TAPIs
2. markSubLibrary() now accepts .tbd as a possible extension

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