Paul Robinson [Tue, 10 Nov 2020 16:18:19 +0000 (08:18 -0800)]
The arm64 triple requires AArch64 not ARM target
Failure seen if you configure ARM target but not AArch64, as here:
http://lab.llvm.org:8011/#/builders/59/builds/271
David Green [Tue, 10 Nov 2020 15:57:58 +0000 (15:57 +0000)]
[ARM] Alter t2DoLoopStart to define lr
This changes the definition of t2DoLoopStart from
t2DoLoopStart rGPR
to
GPRlr = t2DoLoopStart rGPR
This will hopefully mean that low overhead loops are more tied together,
and we can more reliably generate loops without reverting or being at
the whims of the register allocator.
This is a fairly simple change in itself, but leads to a number of other
required alterations.
- The hardware loop pass, if UsePhi is set, now generates loops of the
form:
%start = llvm.start.loop.iterations(%N)
loop:
%p = phi [%start], [%dec]
%dec = llvm.loop.decrement.reg(%p, 1)
%c = icmp ne %dec, 0
br %c, loop, exit
- For this a new llvm.start.loop.iterations intrinsic was added, identical
to llvm.set.loop.iterations but produces a value as seen above, gluing
the loop together more through def-use chains.
- This new instrinsic conceptually produces the same output as input,
which is taught to SCEV so that the checks in MVETailPredication are not
affected.
- Some minor changes are needed to the ARMLowOverheadLoop pass, but it has
been left mostly as before. We should now more reliably be able to tell
that the t2DoLoopStart is correct without having to prove it, but
t2WhileLoopStart and tail-predicated loops will remain the same.
- And all the tests have been updated. There are a lot of them!
This patch on it's own might cause more trouble that it helps, with more
tail-predicated loops being reverted, but some additional patches can
hopefully improve upon that to get to something that is better overall.
Differential Revision: https://reviews.llvm.org/D89881
Ayshe Kuran [Tue, 10 Nov 2020 14:15:32 +0000 (14:15 +0000)]
Fix PR47973: Addressing integer division edge case with INT_MIN
Adjustment to integer division in int_div_impl.inc to avoid undefined behaviour that can occur as a result of having INT_MIN as one of the parameters.
Reviewed By: sepavloff
Differential Revision: https://reviews.llvm.org/D90218
Alexey Bataev [Tue, 10 Nov 2020 15:38:10 +0000 (07:38 -0800)]
Revert "[libomptarget] Add support for target update non-contiguous"
This reverts commit
6847bcec1aa9e262e2b175926d94a12fc1174c6d. It breaks
the build of libomptarget.
Simon Pilgrim [Tue, 10 Nov 2020 15:45:09 +0000 (15:45 +0000)]
[X86] Remove unused check-prefixes from vector rotate tests
Simon Pilgrim [Tue, 10 Nov 2020 15:39:55 +0000 (15:39 +0000)]
[X86] Remove unused check-prefixes from vector trunc tests
Simon Pilgrim [Tue, 10 Nov 2020 15:30:34 +0000 (15:30 +0000)]
[X86] Remove unused check-prefixes from vector funnel shift tests
George Mitenkov [Tue, 10 Nov 2020 14:57:49 +0000 (17:57 +0300)]
[MLIR][SPIRVToLLVM] Enhanced conversion for execution mode
This patch introduces a new conversion pattern for `spv.ExecutionMode`.
`spv.ExecutionMode` may contain important information about the entry
point, which we want to preserve. For example, `LocalSize` provides
information about the work-group size that can be reused. Hence, the
pattern for entry-point ops changes to the following:
- `spv.EntryPoint` is still simply removed
- Info from `spv.ExecutionMode` is used to create a global struct variable,
which looks like:
```
struct {
int32_t executionMode;
int32_t values[]; // optional values
};
```
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D89989
Pavel Labath [Thu, 5 Nov 2020 09:28:31 +0000 (10:28 +0100)]
[lldb/DWARF] Fix sizes of DW_OP_const[1248][us] and DW_OP_litN results
Dwarf says (Section 2.5.1.1. of DWARF v5) that these operations should
push "generic" (pointer-sized) values. This was not the case for
DW_OP_const operations (which were pushing values based on the size of
arguments), nor DW_OP_litN (which were always pushing 64-bit values).
The practical effect of this that were were unable to display the values
of variables if the size of the DW_OP_const opcode was smaller than the
value of the variable it was describing. This would happen because we
would store this (small) result into a buffer and then would not be able
to read sufficient data out of it (in Value::GetValueAsData). Gcc emits
debug info like this.
Other (more subtle) effects are also possible.
The same fix should be applied to DW_OP_const[us] (leb128 versions), but
I'm not doing that right now, because that would cause us to display
wrong (truncated) values of variables on 32-bit targets (pr48087).
Differential Revision: https://reviews.llvm.org/D90840
Muiez Ahmed [Tue, 10 Nov 2020 14:54:03 +0000 (09:54 -0500)]
[SystemZ][z/OS] Enable POSIX_l functions for z/OS
The aim of this patch is to enable POSIX _l functions for z/OS. In particular, the functions are provided with libc++ and this patch resorts to the fallback functions. Nonetheless, the functions are being added so the implementation of the ctype<> member functions can call them. The following changes were needed to allow for a successful build when using the libc++ library for z/OS.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D90319
Raphael Isemann [Tue, 10 Nov 2020 14:45:35 +0000 (15:45 +0100)]
[lldb] Reinstate TestGdbserverPort.test
This test was deleted by accident in the great lldb-mi removal:
37fed664022e07c2293b674e9c9d2b50aac547ba
Simon Pilgrim [Tue, 10 Nov 2020 14:24:00 +0000 (14:24 +0000)]
[ValueTacking] assume-queries-counter.ll - remove unused check prefix
Simon Pilgrim [Tue, 10 Nov 2020 14:23:10 +0000 (14:23 +0000)]
[BasicAA] phi-values-usage.ll - remove unused check prefix
Simon Pilgrim [Tue, 10 Nov 2020 14:22:16 +0000 (14:22 +0000)]
[ScalarEvolution] Remove unused check prefixes
Paul C. Anagnostopoulos [Sun, 8 Nov 2020 20:53:22 +0000 (15:53 -0500)]
[IR] [TableGen] Cleanup pass over the IR TableGen files, part 2
This pass cleans up NVVM.
Differential Revision: https://reviews.llvm.org/D91097
Nathan James [Tue, 10 Nov 2020 14:27:22 +0000 (14:27 +0000)]
[clang-tidy][NFC] Tweak GlobList to iterate backwards
By iterating backwards over the globs we can exit the loop as soon as we find a match.
While we're here:
- Regex doesn't need to be mutable.
- We can reserve the amount of Globs needed ahead of time.
- Using a SmallVector with size 0 is slightly more space efficient than a std::vector.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D91033
Raphael Isemann [Tue, 10 Nov 2020 14:25:08 +0000 (15:25 +0100)]
[lldb] Fix TestErrorMessages test on standalone builds by adding lldb-server substitution
It seems that TestErrorMessages.test is failing on the standalone + Xcode builds
as lldb-server executable can't be found by lit's default PATH search. I assume
invoking lldb-server via a lit substitution gets this working again as
everything else is working, so that's what this patch is doing.
I had to add the lldb-server substitution as the test seems lldb-server specific
and we don't want it to default to debugserver on Darwin.
Using a substitution also seems in general like a good idea so that the commands
lit is printing on failure are using the full path to lldb-server and can be
re-run in a terminal.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D91155
Sanjay Patel [Tue, 10 Nov 2020 13:11:39 +0000 (08:11 -0500)]
[CostModel] remove cost-kind predicate for intrinsics in basic TTI implementation
This is the last step in removing cost-kind as a consideration in the basic class model for intrinsics.
See D89461 for the start of that.
Subsequent commits dealt with each of the special-case intrinsics that had customization here in the
basic class. This should remove a barrier to retrying
D87188 (canonicalization to the abs intrinsic).
The ARM and x86 cost diffs seen here may be wrong because the target-specific overrides have their own
bugs, but we hope this is less wrong - if something has a significant throughput cost, then it should
have a significant size / blended cost too by default.
The only behavioral diff in current regression tests is shown in the x86 scatter-gather test (which is
misplaced or broken because it runs the entire -O3 pipeline) - we unrolled less, and we assume that is
a improvement.
Differential Revision: https://reviews.llvm.org/D90554
Michał Górny [Sun, 8 Nov 2020 15:40:49 +0000 (16:40 +0100)]
[lldb] [Process/FreeBSDRemote] Explicitly copy dbregs to new threads
Explicitly copy dbregs to new threads to ensure that watchpoints
are propagated properly. Fixes the test failure due to apparent kernel
race between reporting a new thread and resuming main thread execution
that makes implicit inheritance of dbregs unreliable. By copying them
explicitly, we ensure that the new thread correctly respects watchpoints
that were set after the thread was created but before it was reported.
The code is copied from the NetBSD plugin and modernized to use
llvm::Error.
Differential Revision: https://reviews.llvm.org/D91032
Michał Górny [Mon, 9 Nov 2020 14:24:48 +0000 (15:24 +0100)]
[lldb] [Process/FreeBSDRemote] Correct DS/ES/FS/GS register sizes
Fix DS/ES/FS/GS register sizes in getter/setter for FreeBSD. Apparently
only CS and SS registers are specified as 64/32-bit in LLDB, while
the others are specified as 16-bit. This fixes the failing
StandardStartupTest.TestStopReplyContainsThreadPcs lldb-server unittest.
Differential Revision: https://reviews.llvm.org/D91076
Michał Górny [Sat, 7 Nov 2020 17:54:07 +0000 (18:54 +0100)]
[lldb] [Process/FreeBSDRemote] Fix handling user-generated SIGTRAP
Update the SIGTRAP handler to account for the possibility of SIGTRAP
being generated by the user, i.e. not having any specific debugging
event associated with it, as well as receiving unknown SIGTRAPs. These
instances of SIGTRAP are passed to the regular signal handler.
Differential Revision: https://reviews.llvm.org/D91007
Simon Pilgrim [Tue, 10 Nov 2020 13:09:31 +0000 (13:09 +0000)]
[MC][Disassembler][AMDGPU] Remove unused check prefix
Simon Pilgrim [Tue, 10 Nov 2020 13:06:09 +0000 (13:06 +0000)]
[MC][MIPS] Remove unused check prefixes
Simon Pilgrim [Tue, 10 Nov 2020 12:54:37 +0000 (12:54 +0000)]
[CostModel][ARM] Remove unused check-prefix
Simon Pilgrim [Tue, 10 Nov 2020 12:54:06 +0000 (12:54 +0000)]
[CostModel][AArch64] Remove unused check-prefix
Kazushi (Jam) Marukawa [Thu, 5 Nov 2020 01:32:34 +0000 (10:32 +0900)]
[VE][NFC] Change cast to dyn_cast
We used cast where we should use dyn_cast. So, change it this time.
Old code cause problems if I implement brind instruction and compile
openmp using new compiler.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D91151
Simon Pilgrim [Tue, 10 Nov 2020 12:48:02 +0000 (12:48 +0000)]
[CostModel][X86] Remove unused check-prefixes
Wang, Pengfei [Tue, 10 Nov 2020 12:42:10 +0000 (20:42 +0800)]
[CodeGen][X86] Remove unused check-prefixes from more avx512 tests. NFCI.
Pablo Barrio [Fri, 18 Sep 2020 13:50:56 +0000 (14:50 +0100)]
[AArch64] Enable RAS 1.1 system registers in all AArch64
Some use cases (e.g. kernel devs) have strict requirements to only enable
features available with -march=armv8-a, e.g. no armv8.1-a. Enabling RAS 1.1 in
all AArch64 means they can consider to support it.
Bear in mind that the first versions of the Armv8 architecture still do not
support RAS 1.1. This patch only lets devs write code with the user-friendly
register mnemonic instead of the ugly generic S<op0>_<op1>_<Cn>_<Cm>_<op2>.
They still need to place runtime checks to make sure that the CPU to run on
supports RAS 1.1.
Differential Revision: https://reviews.llvm.org/D90594
Haojian Wu [Tue, 10 Nov 2020 12:05:45 +0000 (13:05 +0100)]
Fix the buildbot failure.
Looks like we hit a bug in iterator of DeclContextLookupResult, workaround
by a forloop.
http://45.33.8.238/win/27605/step_4.txt
Kirill Bobyrev [Tue, 10 Nov 2020 12:07:03 +0000 (15:07 +0300)]
[clangd] Fix recommended gRPC version
Typo: 1.32.2 does not exist, it should be 1.33.2 https://github.com/grpc/grpc/releases/tag/v1.33.2
Sanne Wouda [Wed, 21 Oct 2020 11:01:59 +0000 (11:01 +0000)]
Add loop distribution to the LTO pipeline
The LoopDistribute pass is missing from the LTO pipeline, so
-enable-loop-distribute has no effect during post-link. The pre-link
loop distribution doesn't seem to survive the LTO pipeline either.
With this patch (and -flto -mllvm -enable-loop-distribute) we see a 43%
uplift on SPEC 2006 hmmer for AArch64. The rest of SPECINT 2006 is
unaffected.
Differential Revision: https://reviews.llvm.org/D89896
Wang, Pengfei [Tue, 10 Nov 2020 12:01:45 +0000 (20:01 +0800)]
[CodeGen][X86] Remove unused check-prefixes from some avx512 tests. NFCI.
Kazushi (Jam) Marukawa [Tue, 10 Nov 2020 04:42:24 +0000 (13:42 +0900)]
[VE] Support inline assembly with vector regsiters
Support inline assembly with vector registers. Add a regression test also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D91146
Sander de Smalen [Tue, 10 Nov 2020 08:32:23 +0000 (08:32 +0000)]
[LoopVectorizer] NFC: Propagate ElementCount to more interfaces.
Interfaces changed to take `ElementCount` as parameters:
* LoopVectorizationPlanner::buildVPlans
* LoopVectorizationPlanner::buildVPlansWithVPRecipes
* LoopVectorizationCostModel::selectVectorizationFactor
This patch is NFC for fixed-width vectors.
Reviewed By: dmgreen, ctetreau
Differential Revision: https://reviews.llvm.org/D90879
Michał Górny [Mon, 9 Nov 2020 11:05:54 +0000 (12:05 +0100)]
[lldb] [test] Rename '.categories' to 'categories'
Make category-specifying files visible. There is really no good reason
to keep them hidden, and having them visible increases the chances
that someone will actually spot them.
Differential Revision: https://reviews.llvm.org/D91065
Michał Górny [Mon, 9 Nov 2020 09:47:22 +0000 (10:47 +0100)]
[lldb] [test] Skip ObjC-based tests via 'objc' category
Replace the plethora of ObjC-implied 'skipUnlessDarwin' decorators
with marking tests as 'objc' category (whenever missing), and skip all
ObjC tests on non-Darwin platforms. I have used '.categories' file
wherever it was present already or all (>1) tests were relying on ObjC,
and explicit add_test_categories() where there was only one test.
Differential Revision: https://reviews.llvm.org/D91056
Joe Ellis [Tue, 10 Nov 2020 10:55:20 +0000 (10:55 +0000)]
[SVE][AArch64] Improve specificity of vectorization legality TypeSize test
The test was using -O2, where -loop-vectorize will suffice.
Reviewed By: fpetrogalli
Differential Revision: https://reviews.llvm.org/D90685
Simon Pilgrim [Tue, 10 Nov 2020 10:48:48 +0000 (10:48 +0000)]
[X86] Remove unused check-prefixes from some vector tests
Simon Pilgrim [Tue, 10 Nov 2020 10:17:46 +0000 (10:17 +0000)]
Add a llvm_unreachable to fix MSVC unhandled enum warning. NFCI.
Stefan Gränitz [Tue, 10 Nov 2020 10:36:59 +0000 (11:36 +0100)]
[lldb][ObjectFile] Relocate sections for in-memory objects (e.g. received via JITLoaderGDB)
Part 2 of a fix for JITed code debugging. This has been a regression from 5.0 to 6.0 and it's still reproducible on current master: https://bugs.llvm.org/show_bug.cgi?id=36209 Part 1 was D61611 a while ago.
The in-memory object files we obtain from JITLoaderGDB are not yet relocated. It looks like this used to happen on the LLDB side and my guess is that it broke with D38142. (However, it's hard to tell because the whole thing was broken already due to the bug in part 1.) The patch moved relocation resolution to a later point in time and didn't apply it to in-memory objects. I am not aware of any reason why we wouldn't resolve relocations per-se, so I made it unconditional here. On Debian, it fixes the bug for me and all tests in `check-lldb` are still fine.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D90769
Mirko Brkusanin [Fri, 6 Nov 2020 14:36:17 +0000 (15:36 +0100)]
[GlobalISel] Add combine for (x | mask) -> x when (x | mask) == x
If we have a mask, and a value x, where (x | mask) == x, we can drop the OR
and just use x.
Differential Revision: https://reviews.llvm.org/D90952
Mirko Brkusanin [Fri, 6 Nov 2020 13:15:10 +0000 (14:15 +0100)]
[GlobalISel] Expand combine for (x & mask) -> x when (x & mask) == x
We can use KnownBitsAnalysis to cover cases when mask is not trivial. It can
also help with cases when mask is not constant but can still be folded into
one. Since 'and' is comutative we should treat both operands as possible
replacements.
Differential Revision: https://reviews.llvm.org/D90674
Mirko Brkusanin [Fri, 30 Oct 2020 14:35:42 +0000 (15:35 +0100)]
[AMDGPU][GlobalISel] Combine shift + logic + shift with constant operands
This sequence of instructions can be simplified if they are single use and
some operands are constants. Additional combines may be applied afterwards.
Differential Revision: https://reviews.llvm.org/D90223
Mirko Brkusanin [Thu, 29 Oct 2020 17:12:21 +0000 (18:12 +0100)]
[AMDGPU][GlobalISel] Fold a chain of two shift instructions with constant operands
Sequence of same shift instructions with constant operands can be combined into
a single shift instruction.
Differential Revision: https://reviews.llvm.org/D90217
James Henderson [Fri, 6 Nov 2020 13:55:10 +0000 (13:55 +0000)]
[lld][ELF][test] Add additional --symbol-ordering-file testing
This covers a few cases that aren't otherwise tested:
1) Non-ascii symbol names are ordered.
2) Comments, whitespace and blank lines are trimmed.
3) Missing order files result in an error.
Reviewed by: MaskRay, grimar
Differential Revision: https://reviews.llvm.org/D90933
James Henderson [Tue, 3 Nov 2020 14:41:09 +0000 (14:41 +0000)]
[lld][ELF] Add additional time trace categories
I noticed when running a large link with the --time-trace option that
there were several areas which were missing any specific time trace
categories (aside from the generic link/ExecuteLinker categories). This
patch adds new categories to fill most of the "gaps", or to provide more
detail than was previously provided.
Reviewed by: MaskRay, grimar, russell.gallop
Differential Revision: https://reviews.llvm.org/D90686
Alex Zinenko [Mon, 9 Nov 2020 16:29:21 +0000 (17:29 +0100)]
[mlir] ODS-backed python binding generator for custom op classes
Introduce an ODS/Tablegen backend producing Op wrappers for Python bindings
based on the ODS operation definition. Usage:
mlir-tblgen -gen-python-op-bindings -Iinclude <path/to/Ops.td> \
-bind-dialect=<dialect-name>
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D90960
Kazushi (Jam) Marukawa [Tue, 10 Nov 2020 04:42:24 +0000 (13:42 +0900)]
[VE] Support inline assembly
Support inline assembly with scalar registers. Add a regression test also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D91119
Alex Zinenko [Fri, 6 Nov 2020 14:09:54 +0000 (15:09 +0100)]
[mlir] Support slicing for operands in results in Python bindings
Slicing, that is element access with `[being:end:step]` structure, is
a common Python idiom for sequence-like containers. It is also necessary
to support custom accessor for operations with variadic operands and
results (an operation an return a slice of its operands that correspond
to the given variadic group).
Add generic utility to support slicing in Python bindings and use it
for operation operands and results.
Depends On D90923
Reviewed By: stellaraccident, mehdi_amini
Differential Revision: https://reviews.llvm.org/D90936
Haojian Wu [Tue, 10 Nov 2020 08:13:32 +0000 (09:13 +0100)]
[clangd] Bump index version number.
https://reviews.llvm.org/D89670 changed the Ref structure, we need to
bump the version to invalidate all stored stale data, otherwise we will
get ` Error while reading shard: malformed or truncated refs` when
building the background index.
Differential Revision: https://reviews.llvm.org/D91131
Kirill Bobyrev [Tue, 10 Nov 2020 09:17:31 +0000 (10:17 +0100)]
[clangd] Update remote index documentation
* Even though remote index is still somewhat experimental, it can now be
used withing clangd itself: this should be the primary way of trying
it out
* Remove `protobuf-compiler` from list of needed Debian packages as it
`protobuf-compiler-grpc` already depends on it
* Bump recommended gRPC version to 1.32.3
Jay Foad [Mon, 9 Nov 2020 10:46:38 +0000 (10:46 +0000)]
[AMDGPU] Remove an unused return value. NFC.
Differential Revision: https://reviews.llvm.org/D91063
Kirill Bobyrev [Tue, 10 Nov 2020 09:08:42 +0000 (10:08 +0100)]
[clangd] Enhance Clangd rename testing coverage
We plan to eliminate error-prone and obsolete Clang-Rename API from Clangd. To
do that, we will introduce Decl canonicalization rules that will make renaming
code simpler and easier to maintain (D71880).
To ensure smooth transition to the new implementation, many Clang-Rename tests
will be adopted in Clangd to prevent any possible regressions. This patch is
the first in the chain of test migration patches. It improves existing tests
and adopts tests from Clang-Rename's alias, class and enum testing files.
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D91102
Wang, Pengfei [Tue, 10 Nov 2020 08:06:13 +0000 (16:06 +0800)]
[CodeGen][X86] Remove unused check-prefixes. NFCI.
Artur Bialas [Tue, 10 Nov 2020 08:49:12 +0000 (09:49 +0100)]
[mlir][spirv] Add VectorInsertDynamicOp and vector.insertelement lowering
VectorInsertDynamicOp in SPIRV dialect
conversion from vector.insertelement to spirv VectorInsertDynamicOp
Differential Revision: https://reviews.llvm.org/D90927
Martin Storsjö [Fri, 6 Nov 2020 07:34:17 +0000 (09:34 +0200)]
[libcxx] [test] Simplify the fs helper header for posix cases. NFC.
Differential Revision: https://reviews.llvm.org/D91073
Martin Storsjö [Mon, 9 Nov 2020 11:59:52 +0000 (13:59 +0200)]
[libcxx] [test] Call create_directory_symlink where relevant
Differential Revision: https://reviews.llvm.org/D91072
Martin Storsjö [Mon, 9 Nov 2020 11:59:13 +0000 (13:59 +0200)]
[libcxx] [test] Make a separate create_directory_symlink helper
This more closely mirrors the public API, instead of using an
obscure bool parameter.
Differential Revision: https://reviews.llvm.org/D91071
Martin Probst [Tue, 10 Nov 2020 08:16:49 +0000 (09:16 +0100)]
clang-format: [JS] support new assignment operators.
Before:
a && = b;
After:
a &&= b;
These operators are new additions in ES2021.
Differential Revision: https://reviews.llvm.org/D91132
Max Kazantsev [Tue, 10 Nov 2020 08:00:36 +0000 (15:00 +0700)]
[NFC] Add flag to disable IV widening in indvar instance
This allows us to have control over IV widening in the pipeline.
Haojian Wu [Tue, 10 Nov 2020 07:49:57 +0000 (08:49 +0100)]
[clangd] Add basic conflict detection for the rename.
With this patch, we reject the rename if the new name would conflict with
any other decls in the decl context of the renamed decl.
Differential Revision: https://reviews.llvm.org/D89790
David Blaikie [Tue, 10 Nov 2020 07:27:47 +0000 (23:27 -0800)]
Roll otherwise-unused variable into assert
Esme-Yi [Tue, 10 Nov 2020 06:52:39 +0000 (06:52 +0000)]
[PowerPC] Add an ISEL pattern for Mul with Imm.
Summary: This patch try to do the following transformation if the multiplier doen't fit int16:
(mul X, c1 << c2) -> (rldicr (mulli X, c1) c2)
Reviewed By: jsji, steven.zhang
Differential Revision: https://reviews.llvm.org/D87384
Max Kazantsev [Tue, 10 Nov 2020 06:46:32 +0000 (13:46 +0700)]
[NFC] Different way of getting step
Richard Smith [Mon, 21 Sep 2020 06:18:04 +0000 (23:18 -0700)]
[c++20] For P0732R2 / P1907R1: Basic code generation and name
mangling support for non-type template parameters of class type and
template parameter objects.
The Itanium side of this follows the approach I proposed in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47 on 2020-09-06.
The MSVC side of this was determined empirically by observing MSVC's
output.
Differential Revision: https://reviews.llvm.org/D89998
River Riddle [Tue, 10 Nov 2020 05:50:47 +0000 (21:50 -0800)]
[mlir][Asm] Add support for using an alias for trailing operation locations
Locations often get very long and clutter up operations when printed inline with them. This revision adds support for using aliases with trailing operation locations, and makes printing with aliases the default behavior. Aliases in the trailing location take the form `loc(<alias>)`, such as `loc(#loc0)`. As with all aliases, using `mlir-print-local-scope` can be used to disable them and get the inline behavior.
Differential Revision: https://reviews.llvm.org/D90652
River Riddle [Tue, 10 Nov 2020 05:50:31 +0000 (21:50 -0800)]
[mlir][AsmPrinter] Refactor printing to only print aliases for attributes/types that will exist in the output.
This revision refactors the way that attributes/types are considered when generating aliases. Instead of considering all of the attributes/types of every operation, we perform a "fake" print step that prints the operations using a dummy printer to collect the attributes and types that would actually be printed during the real process. This removes a lot of attributes/types from consideration that generally won't end up in the final output, e.g. affine map attributes in an `affine.apply`/`affine.for`.
This resolves a long standing TODO w.r.t aliases, and helps to have a much cleaner textual output format. As a datapoint to the latter, as part of this change several tests were identified as testing for the presence of attributes aliases that weren't actually referenced by the custom form of any operation.
To ensure that this wouldn't cause a large degradation in compile time due to the second full print, I benchmarked this change on a very large module with a lot of operations(The file is ~673M/~4.7 million lines long). This file before this change take ~6.9 seconds to print in the custom form, and ~7 seconds after this change. In the custom assembly case, this added an average of a little over ~100 miliseconds to the compile time. This increase was due to the way that argument attributes on functions are structured and how they get printed; i.e. with a better representation the negative impact here can be greatly decreased. When printing in the generic form, this revision had no observable impact on the compile time. This benchmarking leads me to believe that the impact of this change on compile time w.r.t printing is closely related to `print` methods that perform a lot of additional/complex processing outside of the OpAsmPrinter.
Differential Revision: https://reviews.llvm.org/D90512
Max Kazantsev [Tue, 10 Nov 2020 05:37:12 +0000 (12:37 +0700)]
[SCEV] Drop cached ranges of AddRecs after flag update
Our range computation methods benefit from no-wrap flags. But if the ranges
were first computed before the flags were set, the cached range will be too
pessimistic.
We need to drop cached ranges whenever we sharpen AddRec's no wrap flags.
Differential Revision: https://reviews.llvm.org/D89847
Reviewed By: fhahn
Haowei Wu [Tue, 10 Nov 2020 04:06:20 +0000 (20:06 -0800)]
[scan-build] Supprot relative 'file' in cdb.
Excluded folders in scan build is turned to absolute path before
comapre to 'file' in cdb. 'file' in cdb might be a path relative
to 'directory', so we need to turn it to absolute path before
comparison.
Patch by Yu Shan
Differential Revision: https://reviews.llvm.org/D90362
Carl Ritson [Tue, 10 Nov 2020 03:16:26 +0000 (12:16 +0900)]
[AMDGPU] Fix lowering of S_MOV_{B32,B64}_term
If the source of S_MOV_{B32,B64}_term is an immediate then it
cannot be lowered to a COPY.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D90451
Qiu Chaofan [Tue, 10 Nov 2020 02:52:13 +0000 (10:52 +0800)]
[PowerPC] [Clang] Port SSE4.1-compatible insert intrinsics
This patch adds three intrinsics compatible to x86's SSE 4.1 on PowerPC
target, with tests:
- _mm_insert_epi8
- _mm_insert_epi32
- _mm_insert_epi64
The intrinsics implementation is contributed by Paul Clarke.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D89242
Arthur Eubanks [Mon, 9 Nov 2020 19:40:49 +0000 (11:40 -0800)]
[NewPM] Port -separate-const-offset-from-gep
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D91095
Michael Kruse [Tue, 10 Nov 2020 00:47:41 +0000 (18:47 -0600)]
[OMPIRBuilder] Start 'Create' methods with lower case. NFC.
For consistency with the IRBuilder, OpenMPIRBuilder has method names starting with 'Create'. However, the LLVM coding style has methods names starting with lower case letters, as all other OpenMPIRBuilder already methods do. The clang-tidy configuration used by Phabricator also warns about the naming violation, adding noise to the reviews.
This patch renames all `OpenMPIRBuilder::CreateXYZ` methods to `OpenMPIRBuilder::createXYZ`, and updates all in-tree callers.
I tested check-llvm, check-clang, check-mlir and check-flang to ensure that I did not miss a caller.
Reviewed By: mehdi_amini, fghanim
Differential Revision: https://reviews.llvm.org/D91109
Kazu Hirata [Tue, 10 Nov 2020 01:29:40 +0000 (17:29 -0800)]
[BranchProbabilityInfo] Use SmallVector (NFC)
This patch simplifies BranchProbabilityInfo by changing the type of
Probs.
Without this patch:
DenseMap<Edge, BranchProbability> Probs
maps an ordered pair of a BasicBlock* and a successor index to an edge
probability.
With this patch:
DenseMap<const BasicBlock *, SmallVector<BranchProbability, 2>> Probs
maps a BasicBlock* to a vector of edge probabilities.
BranchProbabilityInfo has a property that for a given basic block, we
either have edge probabilities for all successors or do not have any
edge probability at all. This property combined with the current map
type leads to a somewhat complicated algorithm in eraseBlock to erase
map entries one by one while increasing the successor index.
The new map type allows us to remove the all edge probabilities for a
given basic block in a more intuitive manner, namely:
Probs.erase(BB);
Differential Revision: https://reviews.llvm.org/D91017
Xun Li [Tue, 10 Nov 2020 01:24:49 +0000 (17:24 -0800)]
[Coroutine] Move all used local allocas to the .resume function
Prior to D89768, any alloca that's used after suspension points will be put on to the coroutine frame, and hence they will always be reloaded in the resume function.
However D89768 introduced a more precise way to determine whether an alloca should live on the frame. Allocas that are only used within one suspension region (hence does not need to live across suspension points) will not be put on the frame. They will remain local to the resume function.
When creating the new entry for the .resume function, the existing logic only moved all the allocas from the old entry to the new entry. This covers every alloca from the old entry. However allocas that's defined afer coro.begin are put into a separate basic block during CoroSplit (the PostSpill basic block). We need to make sure these allocas are moved to the new entry as well if they are used.
This patch walks through all allocas, and check if they are still used but are not reachable from the new entry, if so, we move them to the new entry.
Differential Revision: https://reviews.llvm.org/D90977
Jonas Devlieghere [Tue, 10 Nov 2020 00:36:47 +0000 (16:36 -0800)]
[lldb] Don't use ::exit but instead return from the driver loop (NFC)
This fixes a reproducer test failure that was caused by the undefined
order in which global destructors run. More concretely, the static
instance of the RealFileSystem had been destroyed before we finalized
the reproducer, which uses it to copy files into the reproducer. By
exiting normally, we call SBDebugger::Terminate and finalize the
reproducer before any static dtors are run.
Jonas Devlieghere [Tue, 10 Nov 2020 00:36:03 +0000 (16:36 -0800)]
[lldb] Destory the debugger in the Driver dtor (NFC)
Sam Clegg [Sun, 8 Nov 2020 22:28:13 +0000 (14:28 -0800)]
[libc++] Remove emscripten handling from exception_fallback.ipp
Emscripten doesn't use this file (at least not anymore), it uses
exception_libcxxabi.ipp since _LIBCPPABI_VERSION is defined.
Differential Revision: https://reviews.llvm.org/D91041
Josh Stone [Mon, 9 Nov 2020 23:36:14 +0000 (15:36 -0800)]
Enable opt-bisect for the new pass manager
This instruments a should-run-optional-pass callback using the existing
OptBisect class to decide if new passes should be skipped. Passes that
force isRequired never reach this at all, so they are not included in
"BISECT:" output nor its pass count.
The test case is resurrected from r267022, an early version of D19172
that had new pass manager support (later reverted and redone without).
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D87951
Arthur Eubanks [Mon, 9 Nov 2020 18:35:23 +0000 (10:35 -0800)]
[update_test_checks] Allow opt to have .exe file extension
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D91091
Jonas Devlieghere [Mon, 9 Nov 2020 23:25:59 +0000 (15:25 -0800)]
[lldb] Make GetSelectedOrDummyTarget return the target by reference (NFC)
Return references from GetDummyTarget and GetSelectedOrDummyTarget. This
matches how the APIs are already used in practice.
LLVM GN Syncbot [Mon, 9 Nov 2020 23:03:42 +0000 (23:03 +0000)]
[gn build] Port
dbfa69c5024
Lei Zhang [Mon, 9 Nov 2020 22:57:20 +0000 (17:57 -0500)]
[mlir][spirv] Expose more query APIs directly on TargetEnv
This allows us to omit one level of indirection when querying
the information from the underlying attribute.
Reviewed By: hanchung, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D91080
Jan Svoboda [Mon, 9 Nov 2020 20:51:42 +0000 (15:51 -0500)]
Port some floating point options to new option marshalling infrastructure
This ports a number of OpenCL and fast-math flags for floating point
over to the new marshalling infrastructure.
As part of this, `Opt{In,Out}FFlag` were enhanced to allow other flags to
imply them, via `DefaultAnyOf<>`. For example:
```
defm signed_zeros : OptOutFFlag<"signed-zeros", ...,
"LangOpts->NoSignedZero",
DefaultAnyOf<[cl_no_signed_zeros, menable_unsafe_fp_math]>>;
```
defines `-fsigned-zeros` (`false`) and `-fno-signed-zeros` (`true`)
linked to the keypath `LangOpts->NoSignedZero`, defaulting to `false`,
but set to `true` implicitly if one of `-cl-no-signed-zeros` or
`-menable-unsafe-fp-math` is on.
Note that the initial patch was written Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D82756
Sam McCall [Mon, 9 Nov 2020 22:58:51 +0000 (23:58 +0100)]
Revert "[Syntax] Add minimal TableGen for syntax nodes. NFC"
This reverts commit
55120f74ca12faea0e90fe552c85c14485f1fd91.
Segfaults during build:
http://lab.llvm.org:8011/#/builders/36/builds/1310
Keith Smiley [Mon, 9 Nov 2020 22:47:17 +0000 (14:47 -0800)]
[llvm-cov][NFC] Fix typo in format comment
Sam McCall [Sat, 31 Oct 2020 20:09:11 +0000 (21:09 +0100)]
[Syntax] Add minimal TableGen for syntax nodes. NFC
So far, only used to generate Kind and implement classof().
My plan is to have this general-purpose Nodes.inc in the style of AST
DeclNodes.inc etc, and additionally a special-purpose backend generating
the actual class definitions. But baby steps...
Differential Revision: https://reviews.llvm.org/D90540
Kirill Bobyrev [Mon, 9 Nov 2020 22:03:39 +0000 (23:03 +0100)]
Revert "[llvm] CMake: Force MSVC to read code as UTF-8"
This reverts commit
4d81c8adb6ed9840257f6cb6b93f60856d422a15.
Apparently, we have code that indirectly uses #pragma
execution_character_set which depends on utf-8 not being set:
http://lab.llvm.org:8011/#/builders/127/builds/1161/steps/4/logs/stdio
Rahul Joshi [Mon, 9 Nov 2020 19:43:45 +0000 (11:43 -0800)]
[MLIR] Add setPublic(), setPrivate(), and setNested() to Symbol interface
- Add shorter helper functions to set visibility for Symbols.
Differential Revision: https://reviews.llvm.org/D91096
Louis Dionne [Mon, 9 Nov 2020 21:10:13 +0000 (16:10 -0500)]
[runtimes] Avoid overwriting the rpath unconditionally
When building the runtimes, it's very important not to add rpaths unless
the user explicitly asks for them (the standard way being CMAKE_INSTALL_RPATH),
or to change the install name dir unless the user requests it (via
CMAKE_INSTALL_NAME_DIR).
llvm_setup_rpath() would override the install_name_dir of the runtimes
even if CMAKE_INSTALL_NAME_DIR was specified to something, which is wrong
and in fact even "dangerous" for the runtimes.
This issue was discovered when trying to build libc++ and libc++abi as
system libraries for Apple, where we set the install name dir to /usr/lib
explicitly. llvm_setup_rpath() would cause libc++ to have the wrong install
name dir, and for basically everything on the system to fail to load.
This was discovered just now because we previously used something closer
to a standalone build, where llvm_setup_rpath() wouldn't exist, and hence
not be used.
This is a revert of the following commits:
libunwind:
3a667b9bd8b741f5ac1d8d47857140a3d70737fb
libc++abi:
4877063e195dfcc128451bbf3dd7b03d04d2562f
libc++:
88434fe05fdb112a33052c4d8a91c9e989cb032d
Those added llvm_setup_rpath() for consistency, so it seems reasonable
to revert.
Differential Revision: https://reviews.llvm.org/D91099
Kirill Bobyrev [Mon, 9 Nov 2020 21:49:49 +0000 (22:49 +0100)]
[clang] Simplify buildSyntaxTree API
Follow-up on https://reviews.llvm.org/D88553#inline-837013
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D90672
Kirill Bobyrev [Mon, 9 Nov 2020 21:47:16 +0000 (22:47 +0100)]
[llvm] CMake: Force MSVC to read code as UTF-8
Symptoms: https://github.com/clangd/clangd/issues/571
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D90116
Hansang Bae [Wed, 21 Oct 2020 13:50:31 +0000 (08:50 -0500)]
[OpenMP] Remove obsolete Fortran module file
Modern Fortran compilers support Fortran 90, so we do not need to use
the source code for Fortran compilers that do not support Fortran 90.
Differential Revision: https://reviews.llvm.org/D90077
Kadir Cetinkaya [Mon, 9 Nov 2020 20:54:38 +0000 (21:54 +0100)]
[clangd] Fix shared-lib builds
This breaks a cyclic dependency. clangDeamon doesn't need to depend on
clangdRemoteIndex yet.
Michał Górny [Mon, 9 Nov 2020 14:47:37 +0000 (15:47 +0100)]
[lldb] [Process/NetBSD] Correct DS/ES/FS/GS register sizes
Fix DS/ES/FS/GS register sizes in getter/setter for NetBSD. Apparently
only CS and SS registers are specified as 64/32-bit in LLDB, while
the others are specified as 16-bit.
Differential Revision: https://reviews.llvm.org/D91090
Michael Kruse [Mon, 9 Nov 2020 20:13:17 +0000 (14:13 -0600)]
[OpenMPIRBuilder] Implement CreateCanonicalLoop.
CreateCanonicalLoop generates a standardized control flow structure for OpenMP canonical for loops. The structure can be consumed by loop-associated directives such as worksharing-loop, distribute, simd etc. as well as loop transformations such as tile and unroll.
This is a first design without considering all complexities yet. The control-flow emits more basic block than strictly necessary, but these will be optimized by CFGSimplify anyway, provide a nice separation of concerns and might later be useful with more complex scenarios. I successfully implemented a basic tile construct using this API, which is not part of this patch.
The fundamental building block is the CreateCanonicalLoop that only takes the loop trip count and operates on the logical iteration spaces only. An overloaded CreateCanonicalLoop for using LB, UB, Increment is provided as well, but at least for C++, Clang will need to implement a loop counter to logical induction variable mapping anyway, since iterator overload resolution cannot be done in LLVMFrontend.
As there currently is no user for CreateCanonicalLoop, it is only called from unittests. Similarly, CanonicalLoopInfo::eraseFromParent() is used in my file implementation and might be generally useful for implementing loop-associated constructs, but is not used in this patch itself.
The following non-exhaustive list describes not yet covered items:
* collapse clause (including non-rectangular and non-perfectly nested); idea is to provide a OpenMPIRBuilder::collapseLoopNest method consuming multiple nested loops and returning a new CanonicalLoopInfo that can be used for loop-associated directives.
* simarly: ordered clause for DOACROSS loops
* branch weights
* Cancellation point (?)
* AllocaIP
* break statement (if needed at all)
* Exceptions (if not completely handled in the front-end)
* Using it in Clang; this requires implementing at least one loop-associated construct.
* ...
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90830
Alexander Belyaev [Mon, 9 Nov 2020 15:47:02 +0000 (16:47 +0100)]
[mlir][std] Add ExpandOps pass.
The pass combines patterns of ExpandAtomic, ExpandMemRefReshape,
StdExpandDivs passes. The pass is meant to legalize STD for conversion to LLVM.
Differential Revision: https://reviews.llvm.org/D91082
Arthur Eubanks [Mon, 9 Nov 2020 20:54:13 +0000 (12:54 -0800)]
[NewPM] Add unique-internal-linkage-names to PassRegistry.def
Pass was already ported, just not properly hooked up.
Arthur Eubanks [Mon, 9 Nov 2020 20:47:57 +0000 (12:47 -0800)]
[test] Completely pin PR37334-break-crit-edges-require-dt.ll to legacy PM
This tests legacy PM specific code (https://bugs.llvm.org/show_bug.cgi?id=37334).
This is failing under the new PM because -loop-sink is a function pass,
not a loop pass, and doesn't run -loop-simplify.