Vitaly Buka [Tue, 13 Jul 2021 22:58:55 +0000 (15:58 -0700)]
[NFC][sanitizer] Don't store region_base_ in MemoryMapper
Part of D105778
Matt Arsenault [Wed, 26 Sep 2018 23:36:28 +0000 (09:36 +1000)]
RegAlloc: Allow targets to split register allocation
AMDGPU normally spills SGPRs to VGPRs. Previously, since all register
classes are handled at the same time, this was problematic. We don't
know ahead of time how many registers will be needed to be reserved to
handle the spilling. If no VGPRs were left for spilling, we would have
to try to spill to memory. If the spilled SGPRs were required for exec
mask manipulation, it is highly problematic because the lanes active
at the point of spill are not necessarily the same as at the restore
point.
Avoid this problem by fully allocating SGPRs in a separate regalloc
run from VGPRs. This way we know the exact number of VGPRs needed, and
can reserve them for a second run. This fixes the most serious
issues, but it is still possible using inline asm to make all VGPRs
unavailable. Start erroring in the case where we ever would require
memory for an SGPR spill.
This is implemented by giving each regalloc pass a callback which
reports if a register class should be handled or not. A few passes
need some small changes to deal with leftover virtual registers.
In the AMDGPU implementation, a new pass is introduced to take the
place of PrologEpilogInserter for SGPR spills emitted during the first
run.
One disadvantage of this is currently StackSlotColoring is no longer
used for SGPR spills. It would need to be run again, which will
require more work.
Error if the standard -regalloc option is used. Introduce new separate
-sgpr-regalloc and -vgpr-regalloc flags, so the two runs can be
controlled individually. PBQB is not currently supported, so this also
prevents using the unhandled allocator.
Eli Friedman [Tue, 13 Jul 2021 21:48:47 +0000 (14:48 -0700)]
[ScalarEvolution] Make isKnownNonZero handle more cases.
Using an unsigned range instead of signed ranges is a bit more precise.
Differential Revision: https://reviews.llvm.org/D105941
Vitaly Buka [Tue, 13 Jul 2021 21:54:24 +0000 (14:54 -0700)]
[NFC][sanitizer] Exctract DrainHalfMax
Part of D105778
Vitaly Buka [Tue, 13 Jul 2021 22:31:54 +0000 (15:31 -0700)]
[NFC][sanitizer] Rename some MemoryMapper members
Part of D105778
Geoffrey Martin-Noble [Tue, 13 Jul 2021 19:57:31 +0000 (12:57 -0700)]
[NFC][MLIR][std] Clean up ArithmeticCastOps
The documentation on these was out of sync with the implementation. Also
the declaration of inputs was repeated when it is already part of the
ArithmeticCastOp definition.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D105934
Victor Huang [Tue, 13 Jul 2021 19:57:08 +0000 (14:57 -0500)]
[PowerPC] Add PowerPC compare and multiply related builtins and instrinsics for XL compatibility
This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch adds the builtins and instrisics for compare
and multiply related operations.
Reviewed By: nemanjai, #powerpc
Differential revision: https://reviews.llvm.org/D102875
MaheshRavishankar [Tue, 13 Jul 2021 21:51:20 +0000 (14:51 -0700)]
[mlir][Tensor] Implement `reifyReturnTypeShapesPerResultDim` for `tensor.insert_slice`.
Differential Revision: https://reviews.llvm.org/D105852
Aart Bik [Tue, 13 Jul 2021 19:13:39 +0000 (12:13 -0700)]
[mlir][sparse] add support for std unary operations
Adds zero-preserving unary operators from std. Also adds xor.
Performs minor refactoring to remove "zero" node, and pushed
the irregular logic for negi (not support in std) into one place.
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D105928
Adam Paszke [Tue, 13 Jul 2021 21:35:50 +0000 (14:35 -0700)]
Add more types to the LLVM dialect C API
This includes:
- void type
- array types
- function types
- literal (unnamed) struct types
Reviewed By: jpienaar, ftynse
Differential Revision: https://reviews.llvm.org/D105908
Derek Schuff [Tue, 13 Jul 2021 21:31:19 +0000 (14:31 -0700)]
[WebAssembly] Run varargs codegen test with non-emscripten triple
This is a followup from D105749 to cover both triples in the case
where they differ.
Alexander Yermolovich [Tue, 13 Jul 2021 19:11:53 +0000 (12:11 -0700)]
[LLD] Adding support for RELA for CG Profile.
This is a follow up to https://reviews.llvm.org/D104080, and https://github.com/llvm/llvm-project/commit/
ca3bdb57fa1ac98b711a735de048c12b5fdd8086#diff-e64a48fabe31db213a631fdc5f2acb51bdddf3f16a8fb2928784f4c579229585. The implementation of call graph profile was changed from a black box section to relocation approach. This was done to be compatible with post processing tools like strip/objcopy, and llvm equivalent. When they are invoked on object file before the final linking step with this new approach the symbol indices correctness is preserved.
The GNU binutils tools change the REL section to RELA section, unlike llvm tools. For example when strip -S is run on the ELF object files, as an intermediate step before linking. To preserve compatibility this patch extends implementation in LLD and ELFDumper to support both REL and RELA sections for call graph profile.
Reviewed By: MaskRay, jhenderson
Differential Revision: https://reviews.llvm.org/D105217
Hedin Garca [Tue, 13 Jul 2021 17:19:58 +0000 (17:19 +0000)]
[libc] Capture floating point encoding and arrange it sequentially in memory
Redefined FPBits.h and LongDoubleBitsX86 so its implementation works for the Windows
and Linux platform while maintaining a packed memory alignment of the precision floating
point numbers. For its size in memory to be the same as the data type of the float point number.
This change was necessary because the previous attribute((packed)) specification in the struct was not working
for Windows like it was for Linux and consequently static_asserts in the FPBits.h file were failing.
Reviewed By: aeubanks, sivachandra
Differential Revision: https://reviews.llvm.org/D105561
Caitlyn Cano [Thu, 8 Jul 2021 17:44:10 +0000 (17:44 +0000)]
[libc] Don't pass -fpie/-ffreestanding on Windows
The current compile options function hardcodes the -fpie and
-ffreestanding flags, which don't exist on Windows. This patch sets the
compilation flags conditionally based on the OS specifics.
Reviewed By: sivachandra, aeubanks
Differential Revision: https://reviews.llvm.org/D105643
Vitaly Buka [Tue, 13 Jul 2021 20:37:29 +0000 (13:37 -0700)]
[sanitizer] Few more NFC changes from D105778
Philip Reames [Tue, 13 Jul 2021 20:30:44 +0000 (13:30 -0700)]
[SCEV] Handle zero stride correctly in howManyLessThans
This is split from D105216, but the code is hoisted much earlier into the path where we can actually get a zero stride flowing through. Some fairly simple proofs handle the cases which show up in practice. The only test changes are the cases where we really do need a non-zero divider to produce the right result.
Differential Revision: https://reviews.llvm.org/D105921
Martin Storsjö [Tue, 13 Jul 2021 11:24:51 +0000 (14:24 +0300)]
[libcxx] [docs] Acknowledge that the library is known to work in some configs outside of what's tested in CI
Differential Revision: https://reviews.llvm.org/D105888
Vitaly Buka [Tue, 13 Jul 2021 20:16:46 +0000 (13:16 -0700)]
[NFC][sanitizer] Move MemoryMapper out of SizeClassAllocator64
Part of D105778
Hedin Garca [Wed, 30 Jun 2021 20:08:26 +0000 (20:08 +0000)]
[libc] Add on float properties for precision floating point numbers in FloatProperties.h
Defined constant that express the number of bits for exponent in single and double precision. Added bit masks values and other properties for quad precision floating point numbers that specifically targets architectures defined in PlatfromDefs.h. The exponentWidth values were added to be used in LongDoubleBitsX86.h where the implementation to set the exponent component uses this and the bitWidth value. The need occurred because of the 80-bit quad precision implementation.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D105153
Vedant Kumar [Mon, 12 Jul 2021 16:39:59 +0000 (09:39 -0700)]
[docs/llvm-cov] Document -compilation-dir
Document the `-compilation-dir` option added in D100232.
Differential Revision: https://reviews.llvm.org/D105826
Vitaly Buka [Tue, 13 Jul 2021 20:02:23 +0000 (13:02 -0700)]
[NFC][sanitizer] clang-format part of D105778
Vitaly Buka [Tue, 13 Jul 2021 19:39:16 +0000 (12:39 -0700)]
Revert "sanitizer_common: optimize memory drain"
Breaks https://lab.llvm.org/buildbot/#/builders/anitizer-windows
This reverts commit
d89d3dfae17d7795dc1ef013db66272020de1959.
Arthur O'Dwyer [Tue, 13 Jul 2021 19:57:43 +0000 (15:57 -0400)]
[libc++] [test] Add a missing `()` in TestEachIntegralType.
Hafiz Abid Qadeer [Tue, 13 Jul 2021 18:28:00 +0000 (19:28 +0100)]
[lld][AMDGPU] Handle R_AMDGPU_REL16 relocation.
This patch is a followup patch to https://reviews.llvm.org/D105760 which adds this relocation. This handles the relocation in lld.
The s_branch family of instruction does the following:
PC = PC + signext(simm * 4) + 4
so we we do the opposite on the target address before writing it in the instruction stream.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D105761
thomasraoux [Tue, 13 Jul 2021 17:38:46 +0000 (10:38 -0700)]
[mlir][Vector] Remove Vector TupleOp as it is unused
TupleOp is not used anymore after recent refactoring.
Differential Revision: https://reviews.llvm.org/D105924
Eli Friedman [Tue, 13 Jul 2021 19:21:13 +0000 (12:21 -0700)]
[NFC] Use CHECK-LABEL in trip-count-unknown-stride.ll
Eli Friedman [Tue, 13 Jul 2021 18:32:23 +0000 (11:32 -0700)]
[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
Make sure getMinusSCEV() didn't return a pointer. The following check
would never succeed if it was a pointer, anyway, but calling
getMulExpr() on a pointer SCEV now asserts.
Nico Weber [Tue, 13 Jul 2021 19:15:38 +0000 (15:15 -0400)]
[gn build] (manually) port
303ddb60a2d2
Philip Reames [Tue, 13 Jul 2021 19:01:56 +0000 (12:01 -0700)]
[tests] Precommit a test case from D105216
Artem Belevich [Tue, 13 Jul 2021 18:40:11 +0000 (11:40 -0700)]
Fix cuda-bad-arch.cu test.
Tests for correctness of HIP architecture need `- xhip`
Philip Reames [Tue, 13 Jul 2021 18:51:02 +0000 (11:51 -0700)]
[SCEV] Strengthen inference of RHS > Start in howManyLessThans
Split off from D105216 to simplify review. Rewritten with a lambda to be easier to follow. Comments clarified.
Sorry for no test case, this is tricky to exercise with the current structure of the code. It's about to be hit more frequently in a follow up patch, and the change itself is simple.
Jon Roelofs [Tue, 13 Jul 2021 18:35:48 +0000 (11:35 -0700)]
[Tests] Fix test broken by:
43c7ca8e4963 [AArch64][GlobalISel] Legalize store <2 x i16>
Krishna Kariya [Tue, 13 Jul 2021 18:33:30 +0000 (20:33 +0200)]
[InstCombine] Precommit tests for D105088 (NFC)
Add tests for D105088, as well as an option to disable the
(generally) unsound inttoptr of ptrtoint optimization.
Differential Revision: https://reviews.llvm.org/D105771
Thomas Lively [Tue, 13 Jul 2021 18:25:32 +0000 (11:25 -0700)]
[WebAssembly] Generate checks for simd-load-store-alignment.ll
This will make it easier to update these tests as we add support for generating
more SIMD loads and stores with custom alignments.
Differential Revision: https://reviews.llvm.org/D105862
Victor Huang [Tue, 13 Jul 2021 18:12:58 +0000 (13:12 -0500)]
[PowerPC][NFC] Power ISA features for Semachecking
[NFC] This patch adds features for pwr7, pwr8, and pwr9 that can be
used for semachecking builtin functions that are only valid for certain
versions of ppc.
Reviewed By: nemanjai, #powerpc
Authored By: Quinn Pham <Quinn.Pham@ibm.com>
Differential revision: https://reviews.llvm.org/D105501
Victor Huang [Tue, 13 Jul 2021 17:59:41 +0000 (12:59 -0500)]
Revert "[PowerPC][NFC] Power ISA features for Semachecking"
This reverts commit
10e0cdfc6526578c8892d895c0448e77cb9ba876.
Jon Roelofs [Fri, 9 Jul 2021 18:42:05 +0000 (11:42 -0700)]
[AArch64][GlobalISel] Legalize load <2 x i16>
Differential revision: https://reviews.llvm.org/D105913
Jon Roelofs [Fri, 9 Jul 2021 18:26:20 +0000 (11:26 -0700)]
[AArch64][GlobalISel] Legalize store <2 x i16>
Differential revision: https://reviews.llvm.org/D105912
Artem Belevich [Thu, 1 Jul 2021 16:55:44 +0000 (09:55 -0700)]
[CUDA] Only allow NVIDIA offload-arch during CUDA compilation.
Otherwise, if someone specifies a valid AMD arch, we may end up triggering an
assertion on unexpected arch later on.
Differential Revision: https://reviews.llvm.org/D105295
Philip Reames [Tue, 13 Jul 2021 17:57:44 +0000 (10:57 -0700)]
[test] Add a SCEV backedge computation test with an explicit zero stride
Vitaly Buka [Tue, 13 Jul 2021 18:02:21 +0000 (11:02 -0700)]
[NFC][sanitizer] Remove trailing whitespace
Valeriy Savchenko [Fri, 9 Jul 2021 09:36:13 +0000 (12:36 +0300)]
[analyzer][solver][NFC] Refactor how we detect (dis)equalities
This patch simplifies the way we deal with (dis)equalities.
Due to the symmetry between constraint handler and range inferrer,
we can have very similar implementations of logic handling
questions about (dis)equality and assumptions involving (dis)equality.
It also helps us to remove one more visitor, and removes uncertainty
that we got all the right places to put `trackNE` and `trackEQ`.
Differential Revision: https://reviews.llvm.org/D105693
Valeriy Savchenko [Thu, 8 Jul 2021 17:09:04 +0000 (20:09 +0300)]
[analyzer][solver][NFC] Introduce ConstraintAssignor
The new component is a symmetric response to SymbolicRangeInferrer.
While the latter is the unified component, which answers all the
questions what does the solver knows about a particular symbolic
expression, assignor associates new constraints (aka "assumes")
with symbolic expressions and can imply additional knowledge that
the solver can extract and use later on.
- Why do we need it and why is SymbolicRangeInferrer not enough?
As it is noted before, the inferrer only helps us to get the most
precise range information based on the existing knowledge and on the
mathematical foundations of different operations that symbolic
expressions actually represent. It doesn't introduce new constraints.
The assignor, on the other hand, can impose constraints on other
symbols using the same domain knowledge.
- But for some expressions, SymbolicRangeInferrer looks into constraints
for similar expressions, why can't we do that for all the cases?
That's correct! But in order to do something like this, we should
have a finite number of possible "similar expressions".
Let's say we are asked about `$a - $b` and we know something about
`$b - $a`. The inferrer can invert this expression and check
constraints for `$b - $a`. This is simple!
But let's say we are asked about `$a` and we know that `$a * $b != 0`.
In this situation, we can imply that `$a != 0`, but the inferrer shouldn't
try every possible symbolic expression `X` to check if `$a * X` or
`X * $a` is constrained to non-zero.
With the assignor mechanism, we can catch this implication right at
the moment we associate `$a * $b` with non-zero range, and set similar
constraints for `$a` and `$b` as well.
Differential Revision: https://reviews.llvm.org/D105692
Vitaly Buka [Tue, 13 Jul 2021 17:44:53 +0000 (10:44 -0700)]
[sanitizer] Fix VSNPrintf %V on Windows
Louis Dionne [Mon, 12 Jul 2021 21:50:21 +0000 (17:50 -0400)]
[libc++] Add a CI job for macOS on arm64 hardware 🥳
Differential Revision: https://reviews.llvm.org/D105848
Tom Stellard [Tue, 13 Jul 2021 17:47:29 +0000 (10:47 -0700)]
Fix utils/update_cc_test_checks/check-globals.test on stand-alone builds
We want to use LLVM_EXTERNAL_LIT if defined for the %lit substitution.
Reviewed By: jdenny
Differential Revision: https://reviews.llvm.org/D105873
Peyton, Jonathan L [Tue, 13 Jul 2021 17:33:01 +0000 (12:33 -0500)]
[OpenMP] Fix one sign-compare warning from GCC
Louis Dionne [Tue, 13 Jul 2021 17:07:45 +0000 (13:07 -0400)]
[libc++] NFC: Add comment for running macOS CI setup script remotely
Craig Topper [Tue, 13 Jul 2021 17:27:29 +0000 (10:27 -0700)]
[RISCV] Use DIVUW/REMUW/DIVW instructions for i8/i16/i32 udiv/urem/sdiv when LHS is constant.
We don't really have optimizations for division with a constant
LHS. If we don't use a W instruction we end up needing to sign
or zero extend the RHS to use the 64-bit instruction.
I had to sign_extend i32 constants on the LHS instead of using
any_extend which becomes zero_extend. If we don't do this, constants
that were originally negative become harder to materialize. I think
this problem exists for more of our W instruction cases. For example
(i32 (shl -1, X)), but we don't have lit tests. I'll work on that
as a follow up.
I also left a FIXME for enabling W instruction for RHS constants
under -Oz.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D105769
Amy Kwan [Mon, 12 Jul 2021 21:35:50 +0000 (16:35 -0500)]
[PowerPC] Add FI alignment check if the addressing mode is DS/DQ-Form, emit X-Form if necessary.
This patch adds a function that checks whether or not the frame index
is aligned when the computed addressing mode is an aligned D-Form (DS, or DQ-Form).
If the frame index appears to be unaligned, within these two modes, reset
the mode to X-Form in order to fall back to selection X-Form loads.
A test case is added to ensure that the test emits X-Form loads and not DQ-Form
loads since the frame index is not aligned within the test case.
Differential Revision: https://reviews.llvm.org/D105661
Peyton, Jonathan L [Tue, 13 Jul 2021 17:23:49 +0000 (12:23 -0500)]
[OpenMP][NFC] Change comment style to eliminate warnings from GCC
Standalone build for OpenMP runtime using GCC is giving -Wcomment
warnings where a backslash newline is encountered in the // style
comment. This switches the // style for /* style to silence the
warnings.
Matheus Izvekov [Sat, 10 Jul 2021 00:34:17 +0000 (02:34 +0200)]
[clang] C++98 implicit moves are back with a vengeance
After taking C++98 implicit moves out in D104500,
we put it back in, but now in a new form which preserves
compatibility with pure C++98 programs, while at the same time
giving almost all the goodies from P1825.
* We use the exact same rules as C++20 with regards to which
id-expressions are move eligible. The previous
incarnation would only benefit from the proper subset which is
copy ellidable. This means we can implicit move, in addition:
* Parameters.
* RValue references.
* Exception variables.
* Variables with higher-than-natural required alignment.
* Objects with different type from the function return type.
* We preserve the two-overload resolution, with one small tweak to the
first one: If we either pick a (possibly converting) constructor which
does not take an rvalue reference, or a user conversion operator which
is not ref-qualified, we abort into the second overload resolution.
This gives C++98 almost all the implicit move patterns which we had created test
cases for, while at the same time preserving the meaning of these
three patterns, which are found in pure C++98 programs:
* Classes with both const and non-const copy constructors, but no move
constructors, continue to have their non-const copy constructor
selected.
* We continue to reject as ambiguous the following pattern:
```
struct A { A(B &); };
struct B { operator A(); };
A foo(B x) { return x; }
```
* We continue to pick the copy constructor in the following pattern:
```
class AutoPtrRef { };
struct AutoPtr {
AutoPtr(AutoPtr &);
AutoPtr();
AutoPtr(AutoPtrRef);
operator AutoPtrRef();
};
AutoPtr test_auto_ptr() {
AutoPtr p;
return p;
}
```
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: Quuxplusone
Differential Revision: https://reviews.llvm.org/D105756
Marcos Horro [Tue, 13 Jul 2021 17:07:03 +0000 (19:07 +0200)]
[llvm-mca] [NFC] Formatting code
Applied clang-format to all files. Discarded BottleneckAnalysis.h
80-column width violation since it contains an example of report.
Caught some typos and minor style details.
Reviewed By: andreadb
Differential Revision: https://reviews.llvm.org/D105900
Saleem Abdulrasool [Fri, 19 Mar 2021 15:26:27 +0000 (08:26 -0700)]
AST: correct name decoration for swift async functions on Windows
The name decoration scheme on Windows does not have a vendor namespace,
and the decoration scheme is not shared ownership - it is controlled by
Microsoft. `T` is a reserved identifier for an unknown calling
convention. The `W` identifier has been discussed with Microsoft
offline and is reserved as `Swift_3` as the identifier for the swift
async calling convention. Adjust the name decoration accordingly.
Philip Reames [Tue, 13 Jul 2021 16:58:19 +0000 (09:58 -0700)]
[ScalarEvolution] Fix overflow when computing max trip counts
This is split from D105216 to reduce patch complexity. Original code by Eli with very minor modification by me.
The primary point of this patch is to add the getUDivCeilSCEV routine. I included the two callers with constant arguments as we know those must constant fold even without any of the fancy inference logic.
Arthur Eubanks [Tue, 13 Jul 2021 16:57:37 +0000 (09:57 -0700)]
[NFC] Inline variable to prevent unused variable warning
thomasraoux [Tue, 13 Jul 2021 16:34:48 +0000 (09:34 -0700)]
[mlir] Add support for tensor.extract to comprehensive bufferization
Differential Revision: https://reviews.llvm.org/D105870
Craig Topper [Tue, 13 Jul 2021 06:53:40 +0000 (23:53 -0700)]
[RISCV] Prevent use of t0(aka x5) as rs1 for jalr instructions.
Some microarchitectures treat rs1=x1/x5 on jalr as a hint to pop
the return-address stack. We should avoid using x5 on jalr
instructions since we aren't using x5 as an alternate link register.
Differential Revision: https://reviews.llvm.org/D105875
Guillaume Chatelet [Tue, 13 Jul 2021 16:44:42 +0000 (16:44 +0000)]
Revert "[llvm] Add enum iteration to Sequence"
This reverts commit
a006af5d6ec6280034ae4249f6d2266d726ccef4.
Arthur Eubanks [Tue, 13 Jul 2021 16:29:53 +0000 (09:29 -0700)]
[OpaquePtr] Use byval type more
Arthur Eubanks [Tue, 13 Jul 2021 16:27:09 +0000 (09:27 -0700)]
[OpaquePtr] Get load/store type without PointerType::getElementType()
Arthur Eubanks [Tue, 13 Jul 2021 16:26:39 +0000 (09:26 -0700)]
[OpaquePtr] Use GlobalValue::getValueType() more
Arthur Eubanks [Tue, 13 Jul 2021 16:25:28 +0000 (09:25 -0700)]
[OpaquePtr] Use AllocaInst::getAllocatedType()
Julian Lettner [Mon, 12 Jul 2021 21:00:45 +0000 (14:00 -0700)]
Avoid triggering assert when program calls OSAtomicCompareAndSwapLong
A previous change brought the new, relaxed implementation of "on failure
memory ordering" for synchronization primitives in LLVM over to TSan
land [1]. It included the following assert:
```
// 31.7.2.18: "The failure argument shall not be memory_order_release
// nor memory_order_acq_rel". LLVM (2021-05) fallbacks to Monotonic
// (mo_relaxed) when those are used.
CHECK(IsLoadOrder(fmo));
static bool IsLoadOrder(morder mo) {
return mo == mo_relaxed || mo == mo_consume
|| mo == mo_acquire || mo == mo_seq_cst;
}
```
A previous workaround for a false positive when using an old Darwin
synchronization API assumed this failure mode to be unused and passed a
dummy value [2]. We update this value to `mo_relaxed` which is also the
value used by the actual implementation to avoid triggering the assert.
[1] https://reviews.llvm.org/D99434
[2] https://reviews.llvm.org/D21733
rdar://
78122243
Differential Revision: https://reviews.llvm.org/D105844
Nicolas Vasilache [Tue, 13 Jul 2021 15:32:40 +0000 (15:32 +0000)]
[mlir][Linalg] Properly specify Linalg attribute.
This fixes undefined reference introduced by https://reviews.llvm.org/D105859
Differential Revision: https://reviews.llvm.org/D105897
Fangrui Song [Tue, 13 Jul 2021 16:30:09 +0000 (09:30 -0700)]
[RISCV] Support machine constraint "S"
Similar to D46745, "S" represents an absolute symbolic operand, which
can be used to specify the access models, e.g.
extern int var;
void *addr_via_asm() {
void *ret;
asm("lui %0, %%hi(%1)\naddi %0,%0,%%lo(%1)" : "=r"(ret) : "S"(&var));
return ret;
}
'S' is documented in trunk GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101275
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D105254
Guillaume Chatelet [Tue, 13 Jul 2021 16:22:19 +0000 (16:22 +0000)]
[llvm] Add enum iteration to Sequence
This patch allows iterating typed enum via the ADT/Sequence utility.
Differential Revision: https://reviews.llvm.org/D103900
Aart Bik [Mon, 12 Jul 2021 22:50:47 +0000 (15:50 -0700)]
[mlir][memref] adjust integration tests to new lowering passes
these tests run under the emulator and thus were overlooked
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D105855
Albion Fung [Tue, 13 Jul 2021 16:01:53 +0000 (11:01 -0500)]
[PowerPC] Fix L[D|W]ARX Implementation
LDARX and LWARX sometimes gets optimized out by the compiler
when it is critical to the correctness of the code. This inline asm generation
ensures that it preserved.
Differential Revision: https://reviews.llvm.org/D105754
Simon Pilgrim [Tue, 13 Jul 2021 15:57:40 +0000 (16:57 +0100)]
[InstCombine] Add basic (select C, (gep Ptr, Idx), Ptr) tests from PR50183
Simon Pilgrim [Tue, 13 Jul 2021 15:54:07 +0000 (16:54 +0100)]
[InstCombine] Regenerate select-gep.ll tests
Victor Huang [Tue, 13 Jul 2021 15:46:13 +0000 (10:46 -0500)]
[PowerPC][NFC] Power ISA features for Semachecking
[NFC] This patch adds features for pwr7, pwr8, and pwr9 that can be
used for semachecking builtin functions that are only valid for certain
versions of ppc.
Reviewed By: nemanjai, #powerpc
Authored By: Quinn Pham <Quinn.Pham@ibm.com>
Differential revision: https://reviews.llvm.org/D105501
Anton Zabaznov [Tue, 13 Jul 2021 13:41:21 +0000 (16:41 +0300)]
[OpenCL] Add verbosity when checking support of read_write images
Parenthesis were fixed incorrectly by D105890
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D105892
Tres Popp [Tue, 13 Jul 2021 15:30:53 +0000 (17:30 +0200)]
[mlir] Handle unused variable when assertions are disabled.
John Ericson [Wed, 28 Apr 2021 22:36:47 +0000 (22:36 +0000)]
Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all
This is a second attempt at D101497, which landed as
9a9bc76c0eb72f0f2732c729a460abbd5239c2e3 but had to be reverted in
8cf7ddbdd4e5af966a369e170c73250f2e3920e7.
This issue was that in the case that `COMPILER_RT_INSTALL_PATH` is
empty, expressions like "${COMPILER_RT_INSTALL_PATH}/bin" evaluated to
"/bin" not "bin" as intended and as was originally.
One solution is to make `COMPILER_RT_INSTALL_PATH` always non-empty,
defaulting it to `CMAKE_INSTALL_PREFIX`. D99636 adopted that approach.
But, I think it is more ergonomic to allow those project-specific paths
to be relative the global ones. Also, making install paths absolute by
default inhibits the proper behavior of functions like
`GNUInstallDirs_get_absolute_install_dir` which make relative install
paths absolute in a more complicated way.
Given all this, I will define a function like the one asked for in
https://gitlab.kitware.com/cmake/cmake/-/issues/19568 (and needed for a
similar use-case).
---
Original message:
Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
complier-rt, just use it to define variables for the subdirs which
themselves are used.
This preserves compatibility, but later on we might consider getting rid
of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
subdir variables directly.
---
There was a seaming bug where the (non-Apple) per-target libdir was
`${target}` not `lib/${target}`. I suspect that has to do with the docs
on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
longer true, so I just went ahead and fixed it, allowing me to define
fewer and more sensible variables.
That last part should be the only behavior changes; everything else
should be a pure refactoring.
---
I added some documentation of these variables too. In particular, I
wanted to highlight the gotcha where `-DSomeCachePath=...` without the
`:PATH` will lead CMake to make the path absolute. See [1] for
discussion of the problem, and [2] for the brief official documentation
they added as a result.
[1]: https://cmake.org/pipermail/cmake/2015-March/060204.html
[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#options
In
38b2dec37ee735d5409148e71ecba278caf0f969 the problem was somewhat
misidentified and so `:STRING` was used, but `:PATH` is better as it
sets the correct type from the get-go.
---
D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
it should be feasible to follow both of these up with a simple patch for
compiler-rt analogous to the one for libcxx.
Reviewed By: phosek, #libc_abi, #libunwind
Differential Revision: https://reviews.llvm.org/D105765
Matt Arsenault [Mon, 12 Jul 2021 16:58:56 +0000 (12:58 -0400)]
AMDGPU: Promote signext/zeroext i16 shader returns
This makes them consistent with all the other return convention
handling. If we don't do this, we lose the sext/zext flag if treated
as a full assignment, which complicates a future GlobalISel patch.
Matt Arsenault [Sun, 11 Jul 2021 13:00:14 +0000 (09:00 -0400)]
GlobalISel: Use extension instead of merge with undef in common case
This fixes not respecting signext/zeroext in these cases. In the
anyext case, this avoids a larger merge with undef and should be a
better canonical form.
This should also handle this if a merge is needed, but I'm not aware
of a case where that can happen. In a future change this will also
allow AMDGPU to drop some custom code without introducing regressions.
Matt Arsenault [Sun, 11 Jul 2021 13:58:02 +0000 (09:58 -0400)]
GlobalISel: Remove getIntrinsicID utility function
This is redundant with a method directly on MachineInstr
Matt Arsenault [Tue, 6 Jul 2021 16:02:07 +0000 (12:02 -0400)]
Mips/GlobalISel: Use more standard call lowering infrastructure
This also fixes some missing implicit uses on call instructions, adds
missing G_ASSERT_SEXT/ZEXT annotations, and some missing outgoing
sext/zexts. This also fixes not respecting tablegen requested type
promotions.
This starts treating f64 passed in i32 GPRs as a type of custom
assignment, which restores some previously XFAILed tests. This is due
to getNumRegistersForCallingConv returns a static value, but in this
case it is context dependent on other arguments.
Most of the ugliness is reproducing a hack CC_MipsO32 uses in
SelectionDAG. CC_MipsO32 depends on a bunch of vectors populated from
the original IR argument types in MipsCCState. The way this ends up
working in GlobalISel is it only ends up inspecting the most recently
added vector element. I'm pretty sure there are cleaner ways to do
this, but this seemed easier than fixing up the current DAG
handling. This is another case where it would be easier of the
CCAssignFns were passed the original type instead of only the
pre-legalized ones.
There's still a lot of junk here that shouldn't be necessary. This
also likely breaks big endian handling, but it wasn't complete/tested
anyway since the IRTranslator gives up on big endian targets.
Matt Arsenault [Thu, 8 Jul 2021 23:35:45 +0000 (19:35 -0400)]
Mips: Mark special case calling convention handling as custom
The number of registers used for passing f64 in some cases is context
dependent, and thus getNumRegistersForCallingConv is sometimes
inaccurate. For f64, it reports 1 but is sometimes split into 2 32-bit
registers.
For GlobalISel, the generic argument assignment code expects
getNumRegistersForCallingConv to return an accurate answer. Switch to
marking these arguments as custom so we can deal with this case as a
custom assignment rather.
This temporarily breaks a few globalisel tests which are fixed by a
future change to use more of the generic infrastructure.
Louis Dionne [Tue, 13 Jul 2021 14:48:54 +0000 (10:48 -0400)]
[libc++] Workaround non-constexpr std::exchange pre C++20
std::exchange is only constexpr in C++20 and later. We were using it
in a constructor marked unconditionally constexpr, which caused issues
when building with -std=c++17.
The weird part is that the issue only showed up when building on the
arm64 macs, but that must be caused by the specific version of Clang
used on those. Since the code is clearly wrong and the fix is obvious,
I'm not going to investigate this further.
Louis Dionne [Mon, 12 Jul 2021 21:34:44 +0000 (17:34 -0400)]
[libc++] Target x86_64 only for the backdeployment jobs
Differential Revision: https://reviews.llvm.org/D105846
Louis Dionne [Tue, 13 Jul 2021 14:16:50 +0000 (10:16 -0400)]
[libc++] Generate ABI list for macOS arm64
Hansang Bae [Mon, 12 Jul 2021 15:57:15 +0000 (10:57 -0500)]
[OpenMP] Minor improvement in task allocation
This patch includes a few changes to improve task allocation
performance slightly. These changes are enough to restore performance
drop observed after introducing hidden helper.
Differential Revision: https://reviews.llvm.org/D105715
Bogdan Graur [Tue, 13 Jul 2021 13:38:20 +0000 (15:38 +0200)]
[NFC] Add paranthesis around logical expression to silence -Wlogical-op-parentheses warning.
Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D105890
Simon Pilgrim [Tue, 13 Jul 2021 13:26:03 +0000 (14:26 +0100)]
[InstCombine] Fold lshr/ashr(or(neg(x),x),bw-1) --> zext/sext(icmp_ne(x,0)) (PR50816)
Handle the missing fold reported in PR50816, which is a variant of the existing ashr(sub_nsw(X,Y),bw-1) --> sext(icmp_sgt(X,Y)) fold.
We also handle the lshr(or(neg(x),x),bw-1) --> zext(icmp_ne(x,0)) equivalent - https://alive2.llvm.org/ce/z/SnZmSj
We still allow multi uses of the neg(x) - as this is likely to let us further simplify other uses of the neg - but not multi uses of the or() which would increase instruction count.
Differential Revision: https://reviews.llvm.org/D105764
Dave MacLachlan [Tue, 13 Jul 2021 13:21:25 +0000 (09:21 -0400)]
[clang/objc] Optimize getters for non-atomic, copied properties
Properties that were declared `@property(copy, nonatomic) id foo` make an
unnecessary call to objc_get_property(). This call can be replaced with a
direct access to the backing variable identical to how a `@property(nonatomic)
id foo` would do it.
This reduces codegen by 4 bytes (x86_64/arm64) and removes a cross linkage unit
function call per property declared as copy/nonatomic.
Differential Revision: https://reviews.llvm.org/D105311
Simon Pilgrim [Tue, 13 Jul 2021 12:48:04 +0000 (13:48 +0100)]
[InstCombine] Pre-commit ashr(or(neg(x),x),bw-1) --> sext(icmp_ne(x,0)) tests from D105764
Added 'thwart complexity-based canonicalization' hacks and the lshr(or(neg(x),x),bw-1) --> zext(icmp_ne(x,0)) variants suggested by Sanjay.
Anton Zabaznov [Tue, 13 Jul 2021 12:09:14 +0000 (15:09 +0300)]
[OpenCL] Add support of __opencl_c_read_write_images feature macro
This feature requires support of __opencl_c_images, so diagnostics for that is provided as well
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D104915
Roman Lebedev [Tue, 13 Jul 2021 12:36:46 +0000 (15:36 +0300)]
[libomp] ompd_init(): fix heap-buffer-overflow when constructing libompd.so path
There is no guarantee that the space allocated in `libname`
is enough to accomodate the whole `dl_info.dli_fname`,
because it could e.g. have an suffix - `.5`,
and that highlights another problem - what it should do about suffxies,
and should it do anything to resolve the symlinks before changing the filename?
```
$ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" ./src/utilities/rstest/rstest -c /tmp/
f49137920.NEF
dl_info.dli_fname "/usr/local/lib/libomp.so.5"
strlen(dl_info.dli_fname) 26
lib_path_length 14
lib_path_length + 12 26
=================================================================
==30949==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000002a at pc 0x000000548648 bp 0x7ffdfa0aa780 sp 0x7ffdfa0a9f40
WRITE of size 27 at 0x60300000002a thread T0
#0 0x548647 in strcpy (/home/lebedevri/rawspeed/build-Clang-SANITIZE/src/utilities/rstest/rstest+0x548647)
#1 0x7fb9e3e3d234 in ompd_init() /repositories/llvm-project/openmp/runtime/src/ompd-specific.cpp:102:5
#2 0x7fb9e3dcb446 in __kmp_do_serial_initialize() /repositories/llvm-project/openmp/runtime/src/kmp_runtime.cpp:6742:3
#3 0x7fb9e3dcb40b in __kmp_get_global_thread_id_reg /repositories/llvm-project/openmp/runtime/src/kmp_runtime.cpp:251:7
#4 0x59e035 in main /home/lebedevri/rawspeed/build-Clang-SANITIZE/../src/utilities/rstest/rstest.cpp:491
#5 0x7fb9e3762d09 in __libc_start_main csu/../csu/libc-start.c:308:16
#6 0x4df449 in _start (/home/lebedevri/rawspeed/build-Clang-SANITIZE/src/utilities/rstest/rstest+0x4df449)
0x60300000002a is located 0 bytes to the right of 26-byte region [0x603000000010,0x60300000002a)
allocated by thread T0 here:
#0 0x55cc5d in malloc (/home/lebedevri/rawspeed/build-Clang-SANITIZE/src/utilities/rstest/rstest+0x55cc5d)
#1 0x7fb9e3e3d224 in ompd_init() /repositories/llvm-project/openmp/runtime/src/ompd-specific.cpp:101:17
#2 0x7fb9e3762d09 in __libc_start_main csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/lebedevri/rawspeed/build-Clang-SANITIZE/src/utilities/rstest/rstest+0x548647) in strcpy
Shadow bytes around the buggy address:
0x0c067fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c067fff8000: fa fa 00 00 00[02]fa fa fa fa fa fa fa fa fa fa
0x0c067fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==30949==ABORTING
Aborted
```
Simon Pilgrim [Tue, 13 Jul 2021 11:30:55 +0000 (12:30 +0100)]
[X86][SSE] X86ISD::FSETCC nodes (cmpss/cmpsd) return a 0/-1 allbits signbits result (REAPPLIED)
Annoyingly, i686 cmpsd handling still fails to remove the unnecessary neg(and(x,1))
Reapplied rGe4aa6ad13216 with fix for intrinsic variants of the opcode which uses a vector return type
Frederik Gossen [Mon, 12 Jul 2021 13:38:25 +0000 (15:38 +0200)]
[MLIR] Fix documentation of the `ExecutionEngine` in the toy tutorial example
Differential Revision: https://reviews.llvm.org/D105813
George Rokos [Sat, 10 Jul 2021 11:14:44 +0000 (04:14 -0700)]
[libomptarget] Update device pointer only if needed
Currently, libomptarget will always perform a host-to-device memory transfer in
order to update the device pointer of a PTR_AND_OBJ entry. This is not always
necessary because the device pointer may have been set to the correct pointee
address already, so we can eliminate the redundant memory transfer.
Hafiz Abid Qadeer [Tue, 13 Jul 2021 10:17:04 +0000 (11:17 +0100)]
[AMDGPU] Handle s_branch to another section.
Currently, if target of s_branch instruction is in another section, it will fail with the error of undefined label. Although in this case, the label is not undefined but present in another section. This patch tries to handle this issue. So while handling fixup_si_sopp_br fixup in getRelocType, if the target label is undefined we issue an error as before. If it is defined, a new relocation type R_AMDGPU_REL16 is returned.
This issue has been reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100181 and https://bugs.llvm.org/show_bug.cgi?id=45887. Before https://reviews.llvm.org/D79943, we used to get an crash for this scenario. The crash is fixed now but the we still get an undefined label error. Jumps to other section can arise with hold/cold splitting.
A patch to handle the relocation in lld will follow shortly.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D105760
Jon Chesterfield [Tue, 13 Jul 2021 11:06:55 +0000 (12:06 +0100)]
[libomptarget][devicertl] Remove branches around setting parallelLevel
Simplifies control flow to allow store/load forwarding
This change folds two basic blocks into one, leaving a single store to parallelLevel.
This is a step towards spmd kernels with sufficiently aggressive inlining folding
the loads from parallelLevel and thus discarding the nested parallel handling
when it is unused.
Transform:
```
int threadId = GetThreadIdInBlock();
if (threadId == 0) {
parallelLevel[0] = expr;
} else if (GetLaneId() == 0) {
parallelLevel[GetWarpId()] = expr;
}
// =>
if (GetLaneId() == 0) {
parallelLevel[GetWarpId()] = expr;
}
// because
unsigned GetLaneId() { return GetThreadIdInBlock() & (WARPSIZE - 1);}
// so whenever threadId == 0, GetLaneId() is also 0.
```
That replaces a store in two distinct basic blocks with as single store.
A more aggressive follow up is possible if the threads in the warp/wave
race to write the same value to the same address. This is not done as
part of this change.
```
if (GetLaneId() == 0) {
parallelLevel[GetWarpId()] = expr;
}
// =>
parallelLevel[GetWarpId()] = expr;
// because
unsigned GetWarpId() { return GetThreadIdInBlock() / WARPSIZE; }
// so GetWarpId will index the same element for every thread in the warp
// and, because expr is lane-invariant in this case, every lane stores the
// same value to this unique address
```
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D105699
Jan Kratochvil [Tue, 13 Jul 2021 10:37:53 +0000 (12:37 +0200)]
[lldb] Fix editline unicode on Linux
Based on:
[lldb-dev] proposed change to remove conditional WCHAR support in libedit wrapper
https://lists.llvm.org/pipermail/lldb-dev/2021-July/016961.html
There is already setlocale in lldb/source/Core/IOHandlerCursesGUI.cpp
but that does not apply for Editline GUI editing.
Unaware how to make automated test for this, it requires pty.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D105779
Nicolas Vasilache [Tue, 13 Jul 2021 10:22:51 +0000 (10:22 +0000)]
[mlir][Linalg] Better support for bufferizing non-tensor results.
Clean up corner cases related to elemental tensor / buffer type return values that would previously fail.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D105857
Simon Pilgrim [Tue, 13 Jul 2021 10:25:35 +0000 (11:25 +0100)]
[X86][SSE] Add signbit tests to show cmpss/cmpsd intrinsics not recognised as 'allbits' results.
This adds test coverage for the crash reported on rGe4aa6ad13216
Tim Northover [Tue, 13 Jul 2021 10:23:03 +0000 (11:23 +0100)]
Support: reduce stack used in default size test.
When the sanitizers aren't enabled they can use more than 1KB of stack, causing
an overflow where there shouldn't be.
Should fix Green Dragon test.
Nicolas Vasilache [Tue, 13 Jul 2021 10:20:10 +0000 (10:20 +0000)]
[mlir][Linalg] Add layout specification support to bufferization.
Previously, linalg bufferization always had to be conservative at function boundaries and assume the most dynamic strided memref layout.
This revision introduce the mechanism to specify a linalg.buffer_layout function argument attribute that carries an affine map used to set a less pessimistic layout.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D105859