Yuta Saito [Mon, 8 Mar 2021 19:23:33 +0000 (11:23 -0800)]
[WebAssembly] Add new relocation for location relative data
This `R_WASM_MEMORY_ADDR_SELFREL_I32` relocation represents an offset
between its relocating address and the symbol address. It's very similar
to `R_X86_64_PC32` but restricted to be used for only data segments.
```
S + A - P
```
A: Represents the addend used to compute the value of the relocatable
field.
P: Represents the place of the storage unit being relocated.
S: Represents the value of the symbol whose index resides in the
relocation entry.
Proposal: https://github.com/WebAssembly/tool-conventions/issues/162
Differential Revision: https://reviews.llvm.org/D96659
Philip Reames [Mon, 8 Mar 2021 19:32:31 +0000 (11:32 -0800)]
constify getUnderlyingObject implementation [nfc]
Muiez Ahmed [Mon, 8 Mar 2021 19:20:22 +0000 (19:20 +0000)]
[SystemZ][z/OS] Missing locale functions libc++
The aim is to add the missing z/OS specific locale functions for libc++ (newlocale, freelocale and uselocale).
Reviewed By: ldionne, #libc, curdeius
Differential Revision: https://reviews.llvm.org/D98044
AndreyChurbanov [Mon, 8 Mar 2021 19:17:45 +0000 (22:17 +0300)]
[OpenMP] NFC: temporarily disable assertion until the bug with dependences is fixed
Stephen Tozer [Mon, 8 Mar 2021 19:13:24 +0000 (19:13 +0000)]
Fix: [DebugInfo] Support representation of multiple location operands in SDDbgValue
Removes a "default" label from a fully covered switch, causing errors on
-Wcovered-switch-default builds.
Rob Suderman [Mon, 8 Mar 2021 18:56:44 +0000 (10:56 -0800)]
[MLIR][TOSA] Added lowerings for Reduce operations to Linalg
Lowerings for min, max, prod, and sum reduction operations on int and float
values. This includes reduction tests for both cases.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D97893
gbtozers [Mon, 28 Sep 2020 13:02:51 +0000 (14:02 +0100)]
[DebugInfo] Support representation of multiple location operands in SDDbgValue
This patch modifies the class that represents debug values during ISel,
SDDbgValue, to support multiple location operands (to represent a dbg.value that
uses a DIArgList). Part of this class's functionality has been split off into a
new class, SDDbgOperand.
The new class SDDbgOperand represents a single value, corresponding to an SSA
value or MachineOperand in the IR and MIR respectively. Members of SDDbgValue
that were previously related to that specific value (as opposed to the
variable or DIExpression), such as the Kind enum, have been moved to
SDDbgOperand. SDDbgValue now contains an array of SDDbgOperand instead, allowing
it to hold more than one of these values.
All changes outside SDDbgValue are simply updates to use the new interface.
Differential Revision: https://reviews.llvm.org/D88585
Christian Sigg [Mon, 8 Mar 2021 18:23:24 +0000 (19:23 +0100)]
[mlir] NFC: Add #endif comment.
Jan Kratochvil [Mon, 8 Mar 2021 18:16:59 +0000 (19:16 +0100)]
[nfc] [lldb] Removed unused operator== for DWARFAbbreviationDeclaration and DWARFAttribute
Also DWARFAttribute::operator== was buggy as it was ignoring its `m_value`.
Philip Reames [Mon, 8 Mar 2021 18:00:56 +0000 (10:00 -0800)]
Fix ppc build bot after
239a6181
(Yes, I checked, return undef is the right result for the function.)
Philip Reames [Mon, 8 Mar 2021 17:17:11 +0000 (09:17 -0800)]
[instcombine] Collapse trivial or recurrences
If we have a recurrence of the form <Start, Or, Step> we know that the value taken by the recurrence stabilizes on the first iteration (provided step is loop invariant). We can exploit that fact to remove the loop carried dependence in the recurrence.
Differential Revision: https://reviews.llvm.org/D97578 (or part)
Philip Reames [Mon, 8 Mar 2021 17:13:51 +0000 (09:13 -0800)]
[instcombine] Collapse trivial and recurrences
If we have a recurrence of the form <Start, And, Step> we know that the value taken by the recurrence stabilizes on the first iteration (provided step is loop invariant). We can exploit that fact to remove the loop carried dependence in the recurrence.
Differential Revision: https://reviews.llvm.org/D97578 (and part)
Craig Topper [Mon, 8 Mar 2021 17:11:08 +0000 (09:11 -0800)]
[RISCV] Make use of DAG.getNeutralElement in lowerVECREDUCE to avoid repeating the same list of constants. NFC
Reviewed By: frasercrmck, khchen
Differential Revision: https://reviews.llvm.org/D98091
Craig Topper [Mon, 8 Mar 2021 17:00:17 +0000 (09:00 -0800)]
[RISCV] Add explicit i64 types to RV64 isel patterns to stop tablegen from generating unneeded i32 patterns for RV32 HwMode.
Hongtao Yu [Fri, 5 Mar 2021 02:09:54 +0000 (18:09 -0800)]
[CSSPGO] llvm-profdata support for CS profile.
Context-sensitive AutoFDO profile has a different name scheme where full calling contexts are encoded as function names. When processing CS proifle, llvm-profdata should use full contexts instead of leaf function names.
Reviewed By: wmi, wenlei, wlei
Differential Revision: https://reviews.llvm.org/D97998
Shilei Tian [Mon, 8 Mar 2021 17:02:55 +0000 (12:02 -0500)]
[OpenMP][Clang][NVPTX] Only build one bitcode library for each SM
In D97003, CUDA 9.2 is the minimum requirement for OpenMP offloading on
NVPTX target. We don't need to have macros in source code to select right functions
based on CUDA version. we don't need to compile multiple bitcode libraries of
different CUDA versions for each SM. We don't need to worry about future
compatibility with newer CUDA version.
`-target-feature +ptx61` is used in this patch, which corresponds to the highest
PTX version that CUDA 9.2 can support.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D97198
Philip Reames [Mon, 8 Mar 2021 16:33:05 +0000 (08:33 -0800)]
[gvn] Precisely propagate equalities to phi operands
The code used for propagating equalities (e.g. assume facts) was conservative in two ways - one of which this patch fixes. Specifically, it shifts the code reasoning about whether a use is dominated by the end of the assume block to consider phi uses to exist on the predecessor edge. This matches the dominator tree handling for dominates(Edge, Use), and simply extends it to dominates(BB, Use).
Note that the decision to use the end of the block is itself a conservative choice. The more precise option would be to use the later of the assume and the value, and replace all uses after that. GVN handles that case separately (with the replace operand mechanism) because it used to be expensive to ask dominator questions within blocks. With the new instruction ordering support, we should probably rewrite this code at some point to simplify.
Differential Revision: https://reviews.llvm.org/D98082
Jan Kratochvil [Mon, 8 Mar 2021 16:41:14 +0000 (17:41 +0100)]
[nfc] [lldb] [testsuite] Cleanup of recently added dwarf5-line-strp.s
Sanne Wouda [Wed, 24 Feb 2021 13:05:11 +0000 (13:05 +0000)]
[InstCombine] Add a combine for a shuffle of similar bitcasts
Some intrinsics wrapper code has the habit of ignoring the type of the
elements in vectors, thinking of vector registers as a "bag of bits". As
a consequence, some operations are shared between vectors of different
types are shared. For example, functions that rearrange elements in a
vector can be shared between vectors of int32 and float.
This can result in bitcasts in awkward places that prevent the backend
from recognizing some instructions. For AArch64 in particular, it
inhibits the selection of dup from a general purpose register (GPR), and
mov from GPR to a vector lane.
This patch adds a pattern in InstCombine to move the bitcasts past the
shufflevector if this is possible. Sometimes this even allows
InstCombine to remove the bitcast entirely, as in the included tests.
Alternatively this could be done with a few extra patterns in the
AArch64 backend, but InstCombine seems like a better place for this.
Differential Revision: https://reviews.llvm.org/D97397
Sanne Wouda [Fri, 19 Feb 2021 16:59:33 +0000 (16:59 +0000)]
Rehome an orphaned comment [NFC]
As seen in
35827164c4, the "shuffle x, x, mask" comment has drifted away
from the implementation of the pattern. Put it back.
Raphael Isemann [Mon, 8 Mar 2021 13:00:23 +0000 (14:00 +0100)]
[lldb][NFC] Code style fixes for ClangModulesDeclVendor
Doxygenify comments and remove {} around one line if's.
Nikita Popov [Mon, 8 Mar 2021 16:24:41 +0000 (17:24 +0100)]
[Assembler] Fix global icmp test
Remove test that no longer folds after
f08148e874088a07b972203a183db00de9c38a70.
Florian Hahn [Fri, 5 Mar 2021 16:10:19 +0000 (16:10 +0000)]
[InstCombine] Pre-commit tests for redundant phis with pointer casts.
Pre-commit tests for D98058.
Nikita Popov [Mon, 8 Mar 2021 16:18:01 +0000 (17:18 +0100)]
[ConstantFold] Handle icmp of global and null consistently
Return UGT rather than NE for icmp @g, null, which is slightly
stronger. This is consistent with what we do for more complex
folds. It is somewhat silly that @g ugt null does not get folded
while (gep @g) ugt null does.
Nikita Popov [Mon, 8 Mar 2021 16:12:12 +0000 (17:12 +0100)]
[ConstProp] Fix folding of pointer icmp with signed predicates
While @g ugt null is always true (ignoring weak symbols),
@g sgt null is not necessarily the case -- that would imply that
it is forbidden to place globals in the high half of the address
space.
Nikita Popov [Mon, 8 Mar 2021 16:04:28 +0000 (17:04 +0100)]
[ConstProp] Add more tests for pointer icmp folding (NFC)
Jan Kratochvil [Mon, 8 Mar 2021 16:04:07 +0000 (17:04 +0100)]
[nfc] [lldb] Remove unused function DWARFAttribute::set
Juneyoung Lee [Mon, 8 Mar 2021 16:03:03 +0000 (01:03 +0900)]
Apply update_test_checks.py to test/Transforms/Util/assume-builder.ll (NFC)
Benjamin Kramer [Mon, 8 Mar 2021 14:23:28 +0000 (15:23 +0100)]
[mlir][Shape] Allow shape.split_at to return extent tensors and lower it to std.subtensor
split_at can return an error if the split index is out of bounds. If the
user knows that the index can never be out of bounds it's safe to use
extent tensors. This has a straight-forward lowering to std.subtensor.
Differential Revision: https://reviews.llvm.org/D98177
Tim Northover [Mon, 8 Mar 2021 15:00:28 +0000 (15:00 +0000)]
AArch64/MacOS: switch default CPU to apple-a13.
The DevKits had A12 processors, but they're all gone now and real hardware has
an A13.
Andy Yankovsky [Mon, 8 Mar 2021 12:41:33 +0000 (13:41 +0100)]
[lldb] Fix error message in IRInterpreter
`memory_read_error` -> `memory_write_error`
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D98170
Stephen Tozer [Mon, 8 Mar 2021 15:42:41 +0000 (15:42 +0000)]
Fix 2: [DebugInfo] Support DIArgList in DbgVariableIntrinsic
Changes to function calls in LocalTest resulted in comparisons between
unsigned values and signed literals; the latter have been updated to be
unsigned to prevent this warning.
Peyton, Jonathan L [Mon, 1 Feb 2021 20:08:51 +0000 (14:08 -0600)]
[OpenMP] Fix potential integer overflow in dynamic schedule code
Restrict the chunk_size * chunk_num to only occur for valid
chunk_nums and reimplement calculating the limit to avoid overflow.
Differential Revision: https://reviews.llvm.org/D96747
Nemanja Ivanovic [Thu, 4 Mar 2021 14:07:22 +0000 (08:07 -0600)]
[AIX][TLS] Generate 32-bit general-dynamic access code sequence
Adds support for the TLS general dynamic access model to
assembly files on AIX 32-bit.
To generate the correct code sequence when accessing a TLS variable
`v`, we first create two TOC entry nodes, one for the variable offset, one
for the region handle. These nodes are followed by a `PPCISD::TLSGD_AIX`
node (new node introduced by this patch).
The `PPCISD::TLSGD_AIX` node (`TLSGDAIX` pseudo instruction) is
expanded to 2 copies (to put the variable offset and region handle in
the right registers) and a call to `__tls_get_addr`.
This patch also changes the way TC entries are generated in asm files.
If the generated TC entry is for the region handle of a TLS variable,
we add the `@m` relocation and the `.` prefix to the entry name.
For example:
```
L..C0:
.tc .v[TC],v[TL]@m -> region handle
L..C1:
.tc v[TC],v[TL] -> variable offset
```
Reviewed By: nemanjai, sfertile
Differential Revision: https://reviews.llvm.org/D97948
Giorgis Georgakoudis [Fri, 19 Feb 2021 18:45:40 +0000 (10:45 -0800)]
Run non-filechecked commands in update_cc_test_checks.py
Some tests in clang require running non-filechecked commands to generate the actual filecheck input. For example, tests for openmp offloading require generating the host bc without any checking, before running the clang command to actually generate the filechecked IR of the target device. This patch enables `update_cc_test_checks.py` to run non-filechecked run lines in-place.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D97068
Yashaswini [Mon, 8 Mar 2021 14:41:17 +0000 (20:11 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.7.1 Do Loop restrictions for Threadprivate.
Implementation of Do loop threadprivate check.
Files:
resolve-directives.cpp
Testcases:
omp-do04-positivecase.f90
omp-do04.f90
Reviewed by: Kiran Chandramohan @kiranchandramohan
Differential Revision: https://reviews.llvm.org/D96686
Stephen Tozer [Mon, 8 Mar 2021 14:55:41 +0000 (14:55 +0000)]
Fix: [DebugInfo] Support DIArgList in DbgVariableIntrinsic
This patch removed the only use of a lambda capture, triggering an error
on `-Werror -Wunused-lambda-capture` builds.
Anirudh Prasad [Mon, 8 Mar 2021 14:52:07 +0000 (09:52 -0500)]
[SystemZ][z/OS] Add support to validate a HLASM Label.
- This patch adds in support to determine whether a particular label
is valid for the hlasm variant
- The label syntax being checked is that of an ordinary HLASM symbol
(Reference, Chapter 2 (Coding and Structure) - Terms, Literals and
Expressions - Terms - Symbols - Ordinary Symbol)
- To achieve this, the virtual function isLabel defined in
MCTargetAsmParser.h is made use of
- The isLabel function is overridden in SystemZAsmParser for the
hlasm variant, and the syntax is checked appropriately
- Things remain unchanged for the att variant
- Further patches will add in support to emit the label. These future
patches will make use of this isLabel function
Reviewed By: uweigand, Kai
Differential Revision: https://reviews.llvm.org/D97748
gbtozers [Wed, 30 Sep 2020 15:30:14 +0000 (16:30 +0100)]
[DebugInfo] Support DIArgList in DbgVariableIntrinsic
This patch updates DbgVariableIntrinsics to support use of a DIArgList for the
location operand, resulting in a significant change to its interface. This patch
does not update all IR passes to support multiple location operands in a
dbg.value; the only change is to update the DbgVariableIntrinsic interface and
its uses. All code outside of the intrinsic classes assumes that an intrinsic
will always have exactly one location operand; they will still support
DIArgLists, but only if they contain exactly one Value.
Among other changes, the setOperand and setArgOperand functions in
DbgVariableIntrinsic have been made private. This is to prevent code from
setting the operands of these intrinsics directly, which could easily result in
incorrect/invalid operands being set. This does not prevent these functions from
being called on a debug intrinsic at all, as they can still be called on any
CallInst pointer; it is assumed that any code directly setting the operands on a
generic call instruction is doing so safely. The intention for making these
functions private is to prevent DIArgLists from being overwritten by code that's
naively trying to replace one of the Values it points to, and also to fail fast
if a DbgVariableIntrinsic is updated to use a DIArgList without a valid
corresponding DIExpression.
serge-sans-paille [Mon, 8 Mar 2021 14:15:22 +0000 (15:15 +0100)]
[NFC] Avoid useless BitVector move
Ahsan Saghir [Mon, 8 Feb 2021 14:36:20 +0000 (08:36 -0600)]
[PowerPC] Change target data layout for 16-byte stack alignment
This changes the target data layout to make stack align to 16 bytes
on Power10. Before this change, stack was being aligned to 32 bytes.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D96265
Nico Weber [Sun, 7 Mar 2021 21:58:18 +0000 (16:58 -0500)]
[clang/mac] Accept -why_load and make -whyload an alias for it
From `man ld`:
-why_load Log why each object file in a static library is loaded.
That is, what symbol was needed.
Also called -whyload for compatibility.
`-why_load` is the spelling preferred by the linker and `-whyload` an old
compatibility setting. clang should accept the preferred form, and map both
forms to the preferred form.
Differential Revision: https://reviews.llvm.org/D98156
Sanjay Patel [Mon, 8 Mar 2021 13:52:12 +0000 (08:52 -0500)]
[ConstantFold] allow folding icmp of null and constexpr
I noticed that we were not folding expressions like this:
icmp ult (constexpr), null
in https://llvm.org/PR49355, so we end up with extremely large
icmp instructions as the constant expressions pile up on each other.
There is no potential to mis-fold an unsigned boundary condition
with a zero/null, so this is just falling through a crack in the
pattern matching.
The more general case of comparisons of non-zero constants and
constexpr are more tricky and may require the datalayout to know
how to cast to different types, etc. Negative tests verify that
we are only changing a subset of potential patterns.
Differential Revision: https://reviews.llvm.org/D98150
Sanjay Patel [Mon, 8 Mar 2021 13:39:56 +0000 (08:39 -0500)]
[ConstProp][JumpThreading] add more test coverage for potential nullptr folds; NFC
See D98150.
Martin Storsjö [Sun, 7 Mar 2021 21:49:56 +0000 (23:49 +0200)]
[libcxx] Document windows specifics regarding file_type and perms. NFC.
This was requested in the review of D98138.
Differential Revision: https://reviews.llvm.org/D98155
Sanjay Patel [Mon, 8 Mar 2021 13:23:20 +0000 (08:23 -0500)]
[JumpThreading] auto-generate complete test checks; NFC
Haojian Wu [Mon, 8 Mar 2021 13:15:39 +0000 (14:15 +0100)]
Add "assert require" for the test added in
df9158c9a45a6902c2b0394f9bd6512e3e441f31
The test is using "debug-only", it was failing in opt built mode.
Raphael Isemann [Mon, 8 Mar 2021 10:10:50 +0000 (11:10 +0100)]
[lldb][NFC] std::set -> DenseSet in ClangModulesDeclVendor
ModuleID is just an integer so let's use a DenseSet.
Simon Pilgrim [Mon, 8 Mar 2021 11:44:15 +0000 (11:44 +0000)]
[KnownBits] Add min/max shift amount handling to shl/lshr/ashr KnownBits helpers
Pulled out of the original D90479 patch - also includes the "impossible shift amount" filtering from computeKnownBitsFromShiftOperator.
Differential Revision: https://reviews.llvm.org/D90479
Simon Pilgrim [Fri, 5 Mar 2021 16:21:34 +0000 (16:21 +0000)]
[X86] Break if-else chain. NFCI.
Both if blocks affect control flow - we don't need the else.
Fixes clang-tidy warning.
Alex Richardson [Mon, 8 Mar 2021 10:09:42 +0000 (10:09 +0000)]
[sanitizers] Fix interception of GLibc regexec
Previously, on GLibc systems, the interceptor was calling __compat_regexec
(regexec@GLIBC_2.2.5) insead of the newer __regexec (regexec@GLIBC_2.3.4).
The __compat_regexec strips the REG_STARTEND flag but does not report an
error if other flags are present. This can result in infinite loops for
programs that use REG_STARTEND to find all matches inside a buffer (since
ignoring REG_STARTEND means that the search always starts from the first
character).
The underlying issue is that GLibc's dlsym(RTLD_NEXT, ...) appears to
always return the oldest versioned symbol instead of the default. This
means it does not match the behaviour of dlsym(RTLD_DEFAULT, ...) or the
behaviour documented in the manpage.
It appears a similar issue was encountered with realpath and worked around
in
77ef78a0a5dbaa364529bd05ed7a7bd9a71dd8d4.
See also https://sourceware.org/bugzilla/show_bug.cgi?id=14932 and
https://sourceware.org/bugzilla/show_bug.cgi?id=1319.
Fixes https://github.com/google/sanitizers/issues/1371
Reviewed By: #sanitizers, vitalybuka, marxin
Differential Revision: https://reviews.llvm.org/D96348
serge-sans-paille [Fri, 5 Mar 2021 09:23:28 +0000 (10:23 +0100)]
[NFC] Use ranged loop iteration instead of explicit looping
Jeremy Morse [Mon, 8 Mar 2021 09:48:11 +0000 (09:48 +0000)]
Revert "[tsan] Use large address space mapping on Apple Silicon Macs"
This reverts commit
bde2e5607167f3e9fd8c6b51275fc8ac654230a2.
This patch produces a compile failure on linux amd64 environments, when
running:
ninja GotsanRuntimeCheck
I get various build errors:
../rtl/tsan_platform.h:608: error: use of undeclared identifier 'Mapping'
return MappingImpl<Mapping, Type>();
Here's a buildbot with the same failure during stage "check-tsan in gcc
build", there are other unrelated failures in there.
http://lab.llvm.org:8011/#/builders/37/builds/2831
Frederik Gossen [Wed, 3 Mar 2021 09:18:33 +0000 (10:18 +0100)]
Clarify documentation for `Elementwise`, `Scalarizable`, `Vectorizable`, and
`Tensorizable` traits.
Differential Revision: https://reviews.llvm.org/D97841
Fraser Cormack [Thu, 4 Mar 2021 09:55:14 +0000 (09:55 +0000)]
[RISCV] Add new entry points to getContainerForFixedLengthVector
While working on adding fixed-length vectors to the calling convention,
it was necessary to be able to query for a fixed-length vector container
type without access to an instance of SelectionDAG.
This patch modifies the "main" getContainerForFixedLengthVector function
to use an instance of TargetLowering rather than SelectionDAG, and
preserves the SelectionDAG overload as a wrapper.
An additional non-static version of the function was also added to
simplify the common case in RISCVTargetLowering.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D97925
Saurabh Jha [Mon, 8 Mar 2021 09:25:22 +0000 (09:25 +0000)]
[Matrix] Implement += and -= for MatrixType.
Make sure CompLHSTy is set correctly for += and -= and matrix type
operands.
Bugzilla ticket is here https://bugs.llvm.org/show_bug.cgi?id=46164
Patch by Saurabh Jha <saurabh.jhaa@gmail.com>
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D98075
David Sherwood [Fri, 5 Mar 2021 13:49:50 +0000 (13:49 +0000)]
[LoopVectorize][SVE] Add tests for vectorising conditional loads of invariant addresses
For loops of the form:
void foo(int *a, int *cond, short *inv, long long n) {
for (long long i=0; i<n; ++i) {
if (cond[i])
a[i] = *inv;
}
}
we can vectorise for SVE using masked gather loads where the array
of pointers is simply a vector splat of 'inv' and the mask comes
from the condition 'cond[i] != 0'.
This patch simply adds tests upstream to defend this capability.
Differential Revision: https://reviews.llvm.org/D98043
Raul Tambre [Sat, 6 Mar 2021 09:45:57 +0000 (11:45 +0200)]
[CMake][compiler-rt] Use copying instead of symlinking for LSE builtins on non-Unix-likes
As reported in D93278 post-review symlinking requires privilege escalation on Windows.
Copying is functionally same, so fallback to it for systems that aren't Unix-like.
This is similar to the solution in AddLLVM.cmake.
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D98111
Freddy Ye [Wed, 3 Mar 2021 08:17:37 +0000 (16:17 +0800)]
[X86] Refine "Support -march=alderlake"
Refine "Support -march=alderlake"
Compare with tremont, it includes 25 more new features. They are
adx, aes, avx, avx2, avxvnni, bmi, bmi2, cldemote, f16c, fma, hreset, invpcid,
kl, lzcnt, movdir64b, movdiri, pclmulqdq, pconfig, pku, serialize, shstk, vaes,
vpclmulqdq, waitpkg, widekl.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D97832
Mehdi Amini [Mon, 8 Mar 2021 05:06:33 +0000 (05:06 +0000)]
Forward the `LLVM_ENABLE_LIBCXX` CMake parameter to the mlir standalone test
This allows to build and test MLIR with `-DLLVM_ENABLE_LIBCXX=ON`.
Ta-Wei Tu [Mon, 8 Mar 2021 03:35:35 +0000 (11:35 +0800)]
[LoopInterchange] Replace tightly-nesting-ness check with the one from `LoopNest`
The check `tightlyNested()` in `LoopInterchange` is similar to the one in `LoopNest`.
In fact, the former misses some cases where loop-interchange is not feasible and results in incorrect behaviour.
Replacing it with the much robust version provided by `LoopNest` reduces code duplications and fixes https://bugs.llvm.org/show_bug.cgi?id=48113.
`LoopInterchange` has a weaker definition of tightly or perfectly nesting-ness than the one implemented in `LoopNest::arePerfectlyNested()`.
Therefore, `tightlyNested()` is instead implemented with `LoopNest::checkLoopsStructure` and additional checks for unsafe instructions.
Reviewed By: Whitney
Differential Revision: https://reviews.llvm.org/D97290
Petr Hosek [Sun, 7 Mar 2021 23:08:11 +0000 (15:08 -0800)]
[Driver] Pass --unwindlib=platform to tests that check unwinder
There are two additional cases that were missed in D98131.
Differential Revision: https://reviews.llvm.org/D98158
Arthur O'Dwyer [Mon, 8 Mar 2021 01:22:03 +0000 (20:22 -0500)]
[libc++] Fix typos in the synopsis of bit_xor, bit_not, etc. NFC.
Mehdi Amini [Mon, 8 Mar 2021 00:57:36 +0000 (00:57 +0000)]
Fix build post-revert in
8d5a981a135a
One commit introduced after the reverted change was using an API
introduced there, this is reintroducing the API, but not the original
broken change.
Keith Smiley [Tue, 9 Feb 2021 16:35:25 +0000 (08:35 -0800)]
llvm-nm: add flag to suppress no symbols warning
This spelling matches binutils https://sourceware.org/bugzilla/show_bug.cgi?id=27408
Differential Revision: https://reviews.llvm.org/D83152
Mehdi Amini [Mon, 8 Mar 2021 00:13:26 +0000 (00:13 +0000)]
Revert "[SimplifyCFG] Update FoldBranchToCommonDest to be poison-safe"
This reverts commit
99108c791de0285ee726a10e8274772b18cee73c.
Clang is miscompiling LLVM with this change, a stage-2 build hits
multiple failures.
As a repro, I built clang in a stage1 directory and used it this way:
cmake -G Ninja ../llvm \
-DCMAKE_CXX_COMPILER=`pwd`/../build-stage1/bin/clang++ \
-DCMAKE_C_COMPILER=`pwd`/../build-stage1/bin/clang \
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=On
ninja check-mlir
Whitney Tsang [Sun, 7 Mar 2021 23:51:09 +0000 (23:51 +0000)]
[NFC][LoopUnroll] Add `-unroll-runtime-other-exit-predictable=false` in
`runtime-multiexit-heuristic.ll`
Added -unroll-runtime-other-exit-predictable=false in
runtime-multiexit-heuristic.ll to make it more robust.
runtime-multiexit-heuristic.ll intention is to test
-unroll-runtime-multi-exit=false, so the default value of
-unroll-runtime-other-exit-predictable should not impact the result.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98098
Whitney Tsang [Sun, 7 Mar 2021 23:48:00 +0000 (23:48 +0000)]
[LoopUnrollRuntime] Add option to assume the non latch exit block to be
predictable. (Add LIT)
Reviewed By: Meinersbur, bmahjour
Differential Revision: https://reviews.llvm.org/D97747
Martin Storsjö [Fri, 26 Feb 2021 13:12:37 +0000 (15:12 +0200)]
[libcxx] [test] Don't test CharFile (/dev/null) on windows
Also clarify a nearby comment regarding block devices.
Differential Revision: https://reviews.llvm.org/D98138
Martin Storsjö [Fri, 26 Feb 2021 14:29:16 +0000 (16:29 +0200)]
[libcxx] [test] Fix building create_directory in MSVC configurations
Don't use the mode_t type - the official windows sdk doesn't have that type.
(Mingw headers does have such a typedef though.) The umask function returns
int on windows, in both header variants.
Thus just use auto to deduce the umask return type automatically.
Differential Revision: https://reviews.llvm.org/D98140
Martin Storsjö [Sat, 6 Mar 2021 17:40:51 +0000 (19:40 +0200)]
[libcxx] [test] Clarify and improve consistency in lexically_relative_and_proximate.pass.cpp. NFC.
Use "expect" instead of "output" for generating "proximate_expected",
pass the arguments to PathEq in the same order as above, rename the
"proximate_expected" variable to be consistent with the naming of the
earlier "expect", use .empty() instead of .native().empty().
Differential Revision: https://reviews.llvm.org/D98127
Kuba Mracek [Sun, 7 Mar 2021 20:45:30 +0000 (12:45 -0800)]
[tsan] Use large address space mapping on Apple Silicon Macs
Differential Revision: https://reviews.llvm.org/D86377
Sanjay Patel [Sun, 7 Mar 2021 19:02:10 +0000 (14:02 -0500)]
[ConstProp] add tests for cmp with null and constexpr; NFC
Tony [Sun, 7 Mar 2021 08:49:18 +0000 (08:49 +0000)]
[NFC][AMDGPU] DWARF Extensions For Heterogeneous Debugging clarifications
Clarify that the base type endianity is used when creating implicit
location storage.
Remove duplicate definition of the generic type.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D98137
Matt Arsenault [Sun, 7 Mar 2021 14:56:45 +0000 (09:56 -0500)]
OpaquePtr: Record byref types in bitcode writer
I missed this case when adding byref. I believe this is NFC until
pointee types are really removed.
Matt Arsenault [Sun, 7 Mar 2021 14:59:11 +0000 (09:59 -0500)]
IR: Fix assert string message referring to the wrong attribute
Craig Topper [Sun, 7 Mar 2021 17:48:40 +0000 (09:48 -0800)]
[SelectionDAG] Add computeKnownBits support for ISD::USUBSAT.
The result of ISD::USUBSAT will never be larger than the LHS. We
can use this to put a bound on the number of leading zeros.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D98133
Craig Topper [Sun, 7 Mar 2021 17:36:53 +0000 (09:36 -0800)]
[RISCV] Fold (select_cc (setlt X, Y), 0, ne, trueV, falseV) -> (select_cc X, Y, lt, trueV, falseV)
A setcc can be created during LegalizeDAG after select_cc has been
created. This combine will enable us to fold these late setccs.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D98132
Roman Lebedev [Sun, 7 Mar 2021 17:41:57 +0000 (20:41 +0300)]
[NFCI] Fix polly tests after
b46c085d2b6d15873fb53718f0a70b3848e19e4a
That commit changed SCEVExpander to emit intrinsics instead of icmp+select,
but i forgot about polly, and i'm not sure if any bots complained.
Juneyoung Lee [Sun, 7 Mar 2021 11:27:44 +0000 (20:27 +0900)]
[InstCombine] Add simplification of two logical and/ors
This is a patch that adds folding of two logical and/ors that share one variable:
a && (a && b) -> a && b
a && (a & b) -> a && b
...
This is towards removing the poison-unsafe select optimization (D93065 has more context).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D96945
Craig Topper [Sun, 7 Mar 2021 17:29:54 +0000 (09:29 -0800)]
[RISCV] Fold (select_cc (xor X, Y), 0, eq/ne, trueV, falseV) -> (select_cc X, Y, eq/ne, trueV, falseV)
This pattern occurs when lowering for overflow operations
introduce an xor after select_cc has already been formed.
I had to rework another combine that looked for select_cc of an xor
with 1. That xor will now get combined away so we just need to
look for the RHS of the select_cc being 1.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D98130
Juneyoung Lee [Sun, 7 Mar 2021 17:25:27 +0000 (02:25 +0900)]
[InstCombine] use safe transformation by default
.. since it will be folded into and/or anyway
Nikita Popov [Sun, 7 Mar 2021 17:19:31 +0000 (18:19 +0100)]
[CVP] Remove -cvp-dont-add-nowrap-flags option
This option was originally added to work around a bug in LFTR.
The bug has long since been fixed.
Nikita Popov [Wed, 3 Mar 2021 19:38:50 +0000 (20:38 +0100)]
[DSE] Remove MemDep-based implementation
The MemorySSA-based implementation has been enabled without issue
for a while now, so keeping the old implementation around doesn't
seem useful anymore. This drops the MemDep-based implementation.
Differential Revision: https://reviews.llvm.org/D97877
Juneyoung Lee [Sun, 7 Mar 2021 17:11:01 +0000 (02:11 +0900)]
[InstCombine] fix another poison-unsafe select transformation
This fixes another unsafe select folding by disabling it if
EnableUnsafeSelectTransform is set to false.
EnableUnsafeSelectTransform's default value is true, hence it won't
affect generated code (unless the flag is explicitly set to false).
Juneyoung Lee [Sun, 7 Mar 2021 16:23:04 +0000 (01:23 +0900)]
[SimplifyCFG] Update FoldBranchToCommonDest to be poison-safe
This patch makes FoldBranchToCommonDest merge branch conditions into `select i1` rather than `and/or i1` when it is called by SimplifyCFG.
It is known that merging conditions into and/or is poison-unsafe, and this is towards making things *more* correct by removing possible miscompilations.
Currently, InstCombine simply consumes these selects into and/or of i1 (which is also unsafe), so the visible effect would be very small. The unsafe select -> and/or transformation will be removed in the future.
There has been efforts for updating optimizations to support the select form as well, and they are linked to D93065.
The safe transformation is fired when it is called by SimplifyCFG only. This is done by setting the new `PoisonSafe` argument as true.
Another place that calls FoldBranchToCommonDest is LoopSimplify. `PoisonSafe` flag is set to false in this case because enabling it has a nontrivial impact in performance because SCEV is more conservative with select form and InductiveRangeCheckElimination isn't aware of select form of and/or i1.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D95026
Juneyoung Lee [Sun, 7 Mar 2021 16:05:31 +0000 (01:05 +0900)]
[LoopUnswitch] unswitch if cond is in select form of and/or as well
Hello all,
I'm trying to fix unsafe propagation of poison values in and/or conditions by using
equivalent select forms (`select i1 A, i1 B, i1 false` and `select i1 A, i1 true, i1 false`)
instead.
D93065 has links to patches for this.
This patch allows unswitch to happen if the condition is in this form as well.
`collectHomogenousInstGraphLoopInvariants` is updated to keep traversal if
Root and the visiting I matches both m_LogicalOr()/m_LogicalAnd().
Other than this, the remaining changes are almost straightforward and simply replaces
Instruction::And/Or check with match(m_LogicalOr()/m_LogicalAnd()).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D97756
Juneyoung Lee [Sun, 7 Mar 2021 15:01:05 +0000 (00:01 +0900)]
[InstCombine] enrich select-safe-bool-transforms.ll test (NFC)
for https://reviews.llvm.org/D96945
Juneyoung Lee [Sun, 7 Mar 2021 14:16:39 +0000 (23:16 +0900)]
[ValueTracking] update directlyImpliesPoison to look into select's condition
This is a minor update in directlyImpliesPoison and makes it look into select's
condition.
Splitted from https://reviews.llvm.org/D96945
Simon Pilgrim [Sun, 7 Mar 2021 12:56:35 +0000 (12:56 +0000)]
[X86] canonicalizeShuffleWithBinOps - add X86ISD::PSHUFB handling.
Simon Pilgrim [Sun, 7 Mar 2021 11:17:03 +0000 (11:17 +0000)]
[X86] canonicalizeShuffleWithBinOps - shuffle oneuse constants.
We can freely shuffle all ones/zeros constants but we can also freely shuffle other constants as long as they only have one use.
Martin Storsjö [Thu, 15 Oct 2020 10:47:36 +0000 (13:47 +0300)]
[libcxx] [test] Fix path.modifiers remove_filename and replace_filename for windows
Also fix the synopsis in the replace_filename test, while touching
that file.
Differential Revision: https://reviews.llvm.org/D98108
Martin Storsjö [Thu, 4 Mar 2021 20:48:41 +0000 (22:48 +0200)]
[libunwind] Install the DLL when doing "ninja install"
This matches how install(... RUNTIME) is used in e.g. libcxx.
Differential Revision: https://reviews.llvm.org/D98020
Petr Hosek [Sun, 7 Mar 2021 01:42:36 +0000 (17:42 -0800)]
[Driver] Pass --unwindlib=platform to tests that check unwinder
This addresses an issue which was revealed by D98022.
Differential Revision: https://reviews.llvm.org/D98131
Tony [Sat, 6 Mar 2021 20:12:22 +0000 (20:12 +0000)]
[NFC][AMDGPU]DWARF Extensions For Heterogeneous Debugging generic type endianity
In "DWARF Extensions For Heterogeneous Debugging" document that the
DWARF generic type has a target architecture defined endianity.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D98126
Fangrui Song [Sun, 7 Mar 2021 03:25:22 +0000 (19:25 -0800)]
[MC] Migrate some parseToken(AsmToken::EndOfStatement, ...) to parseEOL()
Fangrui Song [Sun, 7 Mar 2021 01:45:23 +0000 (17:45 -0800)]
[MC] Add parseEOL() overload and migrate some parseToken(AsmToken::EndOfStatement) to parseEOL()
For many directives, the following diagnostics
* `error: unexpected token`
* `error: unexpected token in '.abort' directive"`
are replaced with `error: expected newline`.
`unexpected token` may make the user think a different token is needed.
`expected newline` is clearer about the expected token.
For `in '...' directive`, the directive name is not useful because the next line
replicates the error line which includes the directive.
Fangrui Song [Sun, 7 Mar 2021 00:26:27 +0000 (16:26 -0800)]
[MC] Parse end-of-line for .addrsig & .addrsig_sym
Fangrui Song [Sun, 7 Mar 2021 00:20:55 +0000 (16:20 -0800)]
[MC] Parse end-of-line for .cfi_* directives
Otherwise MCAsmStreamer will emit duplicate newlines.
Kazu Hirata [Sat, 6 Mar 2021 23:52:55 +0000 (15:52 -0800)]
[TableGen] Use range-based for loops (NFC)