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
Sebastian Neubauer [Tue, 6 Jul 2021 09:24:42 +0000 (11:24 +0200)]
[AMDGPU] Optimize VGPR LiveRange in waterfall loops
The loops are run exactly once per lane, so VGPRs do not need to be
saved. Use the SIOptimizeVGPRLiveRange pass to add phi nodes that take
undef when coming from the loop.
There is still a shortcoming:
Return values from a function call in the loop are copied because their
live range conflicts with the live range of arguments, even if arguments
are only IMPLICIT_DEF after the phi insertion.
Differential Revision: https://reviews.llvm.org/D105192
Sebastian Neubauer [Tue, 6 Jul 2021 09:23:06 +0000 (11:23 +0200)]
[AMDGPU] Mark waterfall loops as SI_WATERFALL_LOOP
This way, they can be detected later, e.g. by the
SIOptimizeVGPRLiveRange pass.
Differential Revision: https://reviews.llvm.org/D105467
Anton Zabaznov [Tue, 13 Jul 2021 09:45:38 +0000 (12:45 +0300)]
[OpenCL] Add support of __opencl_c_generic_address_space feature macro
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D103401
Tim Northover [Mon, 28 Jun 2021 13:28:40 +0000 (14:28 +0100)]
AArch64: use 4-byte slots for arm64_32 pointers in a tail call
Guillaume Chatelet [Tue, 13 Jul 2021 09:59:11 +0000 (09:59 +0000)]
[libc] update benchmark distributions
All distributions (expect D) have been updated using 7 days worth of data.
Distributions are smoother.
This patch also moves data from header file to individual csv file. It
helps the editor and allows easier export/plotting of the data.
Differential Revision: https://reviews.llvm.org/D105766
Fraser Cormack [Wed, 23 Jun 2021 14:14:50 +0000 (15:14 +0100)]
[RISCV] Pass undef VECTOR_SHUFFLE indices on to BUILD_VECTOR
Often when lowering vector shuffles, we split the shuffle into two
LHS/RHS shuffles which are then blended together. To do so we split the
original indices into two, indexed into each respective vector. These
two index vectors are then separately lowered as BUILD_VECTORs.
This patch forwards on any undef indices to the BUILD_VECTOR, rather
than having the VECTOR_SHUFFLE lowering decide on an optimal concrete
index. The motiviation for ths change is so that we don't duplicate
optimization logic between the two lowering methods and let BUILD_VECTOR
do what it does best.
Propagating undef in this way allows us, for example, to generate
`vid.v` to produce the LHS indices of commonly-used interleave-type
shuffles. I have designs on further optimizing interleave-type and other
common shuffle patterns in the near future.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D104789
Jeroen Dobbelaere [Tue, 13 Jul 2021 08:37:45 +0000 (10:37 +0200)]
[remangleIntrinsicFunction] Detect and resolve name clash
It is possible that the remangled name for an intrinsic already exists with a different (and wrong) prototype within the module.
As the bitcode reader keeps both versions of all remangled intrinsics around for a longer time, this can result in a
crash, as can be seen in https://bugs.llvm.org/show_bug.cgi?id=50923
This patch makes 'remangleIntrinsicFunction' aware of this situation. When it is detected, it moves the version with the wrong prototype to a different name. That version will be removed anyway once the module is completely loaded.
With thanks to @asbirlea for reporting this issue when trying out an lto build with the full restrict patches, and @efriedma for suggesting a sane resolution mechanism.
Reviewed By: apilipenko
Differential Revision: https://reviews.llvm.org/D105118
Rainer Orth [Tue, 13 Jul 2021 09:15:03 +0000 (11:15 +0200)]
[sanitizer_common] Define internal_usleep on Solaris
The Solaris/amd64 buildbot
<https://lab.llvm.org/staging/#/builders/101/builds/2845> has recently been
broken several times, at least one of those remains unfixed:
[63/446] Generating Sanitizer-x86_64-Test
[...]
Undefined first referenced
symbol in file
_ZN11__sanitizer15internal_usleepEy /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/stage1/projects/compiler-rt/lib/sanitizer_common/tests/libRTSanitizerCommon.test.x86_64.a(sanitizer_common.cpp.o)
ld: fatal: symbol referencing errors
Thist patch fixes it by defining the missing `internal_usleep`.
Tested on `amd64-pc-solaris2.11.`
Differential Revision: https://reviews.llvm.org/D105878
Jeroen Dobbelaere [Tue, 13 Jul 2021 08:16:41 +0000 (10:16 +0200)]
[NFC] Do not track calls to inlined intrinsics in IFI.
Just like intrinsics are not tracked for IFI.InlinedCalls, they should not be tracked for IFI.InlinedCallSites.
In the current top-of-tree this change is a NFC, but the full restrict patches (D68484) potentially trigger an read-after-free
if intrinsics are also added to the InlindeCallSites, due to a late optimization potentially removing some of the inlined intrinsics.
Also see https://lists.llvm.org/pipermail/llvm-dev/2021-July/151722.html for a discussion about the problem.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D105805
Dmitry Vyukov [Sun, 11 Jul 2021 13:12:24 +0000 (15:12 +0200)]
sanitizer_common: optimize memory drain
Currently we allocate MemoryMapper per size class.
MemoryMapper mmap's and munmap's internal buffer.
This results in 50 mmap/munmap calls under the global
allocator mutex. Reuse MemoryMapper and the buffer
for all size classes. This radically reduces number of
mmap/munmap calls. Smaller size classes tend to have
more objects allocated, so it's highly likely that
the buffer allocated for the first size class will
be enough for all subsequent size classes.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D105778
Qiu Chaofan [Tue, 13 Jul 2021 06:50:26 +0000 (14:50 +0800)]
[SelectionDAG] Check use before combining into USUBSAT
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D105789
Stanislav Mekhanoshin [Fri, 9 Jul 2021 21:05:57 +0000 (14:05 -0700)]
[AMDGPU] Make some VOP1 instructions rematerializable
This is a pilot change to verify the logic. The rest will be
done in a same way, at least the rest of VOP1.
Differential Revision: https://reviews.llvm.org/D105742
Qiu Chaofan [Tue, 13 Jul 2021 06:32:30 +0000 (14:32 +0800)]
[PowerPC] Fix typo in vector shuffle combining
a22ecb4 fixed a crash on big endian subtargets. This commit fixes a typo
in that commit which may cause miscompile.
hyeongyu kim [Tue, 13 Jul 2021 06:34:41 +0000 (15:34 +0900)]
[SimplifyCFG] Fix SimplifyBranchOnICmpChain to be undef/poison safe.
This patch fixes the problem of SimplifyBranchOnICmpChain that occurs
when extra values are Undef or poison.
Suppose the %mode is 51 and the %Cond is poison, and let's look at the
case below.
```
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
%C = select i1 %A, i1 %B, i1 false
%D = select i1 %C, i1 %Cond, i1 false
br i1 %D, label %T, label %F
=>
br i1 %Cond, label %switch.early.test, label %F
switch.early.test:
switch i32 %mode, label %T [
i32 51, label %F
i32 0, label %F
]
```
incorrectness: https://alive2.llvm.org/ce/z/BWScX
Code before transformation will not raise UB because %C and %D is false,
and it will not use %Cond. But after transformation, %Cond is being used
immediately, and it will raise UB.
This problem can be solved by adding freeze instruction.
correctness: https://alive2.llvm.org/ce/z/x9x4oY
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D104569
David Green [Tue, 13 Jul 2021 06:31:22 +0000 (07:31 +0100)]
[MIPS] Regenerate test after D105161. NFC
David Green [Tue, 13 Jul 2021 06:21:20 +0000 (07:21 +0100)]
[ARM] Introduce MVEEXT ISel lowering
Similar to D91921 (and D104515) this introduces two MVESEXT and MVEZEXT
nodes that larger-than-legal sext and zext are lowered to. These either
get optimized away or end up becoming a series of stack loads/store, in
order to perform the extending whilst keeping the order of the lanes
correct. They are generated from v8i16->v8i32, v16i8->v16i16 and
v16i8->v16i32 extends, potentially with a intermediate extend for the
larger v16i8->v16i32 extend. A number of combines have been added for
obvious cases that come up in tests, notably MVEEXT of shuffles. More
may be needed in the future, but this seems to cover most of the cases
that come up in the tests.
Differential Revision: https://reviews.llvm.org/D105090
hyeongyu kim [Tue, 13 Jul 2021 06:10:24 +0000 (15:10 +0900)]
[NFC] Edit the comment in M68kInstrInfo::ExpandMOVSZX_RM
Chen Zheng [Tue, 13 Jul 2021 05:37:05 +0000 (05:37 +0000)]
[PowerPC][NFC] add test case for preparing more loads/stores
Nathan Ridge [Tue, 6 Jul 2021 05:40:24 +0000 (01:40 -0400)]
[clang] Refactor AST printing tests to share more infrastructure
Differential Revision: https://reviews.llvm.org/D105457
Vitaly Buka [Tue, 13 Jul 2021 05:23:01 +0000 (22:23 -0700)]
[NFC][scudo] Clang format a file
Vitaly Buka [Tue, 13 Jul 2021 05:20:49 +0000 (22:20 -0700)]
Revert "[X86][SSE] X86ISD::FSETCC nodes (cmpss/cmpsd) return a 0/-1 allbits signbits result"
Fails here https://lab.llvm.org/buildbot/#/builders/37/builds/5267
This reverts commit
e4aa6ad132164839a4a97dff0d433ea4766f77f1.
Jessica Paquette [Wed, 30 Jun 2021 00:01:28 +0000 (17:01 -0700)]
[GlobalISel] Handle more types in narrowScalar for eq/ne G_ICMP
Generalize the existing eq/ne case using `extractParts`. The original code only
handled narrowings for types of width 2n->n. This generalization allows for any
type that can be broken down by `extractParts`.
General overview is:
- Loop over each narrow-sized part and do exactly what the 2-register case did.
- Loop over the leftover-sized parts and do the same thing
- Widen the leftover-sized XOR results to the desired narrow size
- OR that all together and then do the comparison against 0 (just like the old
code)
This shows up a lot when building clang for AArch64 using GlobalISel, so it's
worth fixing. For the sake of simplicity, this doesn't handle the non-eq/ne
case yet.
Also remove the code in this case that notifies the observer; we're just going
to delete MI anyway so talking to the observer shouldn't be necessary.
Differential Revision: https://reviews.llvm.org/D105161
Vitaly Buka [Tue, 13 Jul 2021 05:15:20 +0000 (22:15 -0700)]
Revert "[hwasan] More realistic setjmp test."
Breaks https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-qemu
This reverts commit
5511bfdb671505c1e7968ab8ef6032414bba3852.
SharmaRithik [Tue, 13 Jul 2021 04:52:47 +0000 (04:52 +0000)]
[analyzer] Print time taken to analyze each function
Summary: This patch is a part of an attempt to obtain more
timer data from the analyzer. In this patch, we try to use
LLVM::TimeRecord to save time before starting the analysis
and to print the time that a specific function takes while
getting analyzed.
The timer data is printed along with the
-analyzer-display-progress outputs.
ANALYZE (Syntax): test.c functionName : 0.4 ms
ANALYZE (Path, Inline_Regular): test.c functionName : 2.6 ms
Authored By: RithikSharma
Reviewer: NoQ, xazax.hun, teemperor, vsavchenko
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D105565
Arthur Eubanks [Tue, 13 Jul 2021 04:14:35 +0000 (21:14 -0700)]
[OpaquePtr][ISel] Use ArgListEntry::IndirectType more
Arthur Eubanks [Fri, 9 Jul 2021 16:24:59 +0000 (09:24 -0700)]
[OpaquePointers][ThreadSanitizer] Cleanup calls to PointerType::getElementType()
Reviewed By: #opaque-pointers, dblaikie
Differential Revision: https://reviews.llvm.org/D105710
David Blaikie [Tue, 13 Jul 2021 01:39:41 +0000 (18:39 -0700)]
Fix test - mistaken hardcoded path from my local machine.
David Blaikie [Tue, 13 Jul 2021 01:10:58 +0000 (18:10 -0700)]
DebugInfo: Use debug_rnglists.dwo for ranges in debug_info.dwo when parsing DWARFv5
This call would incorrectly overwrite (with the .debug_rnglists.dwo from
the executable, if there was one) the rnglists section instead of the
correct value (from the .debug_rnglists.dwo in the .dwo file) that's
applied in DWARFUnit::tryExtractDIEsIfNeeded
Aart Bik [Mon, 12 Jul 2021 22:22:31 +0000 (15:22 -0700)]
[mlir][sparse] add support for AND and OR operations
Integral AND and OR follow the simple conjunction and disjuction rules
for lattice building. This revision also completes some of the Merge
refactoring by moving the remainder parts that are merger specific from
sparsification into utils files.
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D105851
Fangrui Song [Tue, 13 Jul 2021 00:44:02 +0000 (17:44 -0700)]
[llc] Default MCUseDwarfDirectory to true
For Clang, `MCUseDwarfDirectory` is true by default for the majority cases
(-fintegrated-as or -gdwarf-5; most targets use -fintegrated-as by default).
Defaulting MCUseDwarfDirectory to true can reduce the differences between clang
and llc.
Reviewed By: #debug-info, dblaikie
Differential Revision: https://reviews.llvm.org/D105856
Hanhan Wang [Tue, 13 Jul 2021 00:25:55 +0000 (17:25 -0700)]
[mlir][Linalg] Add 3D pooling named ops to Linalg.
Reviewed By: gysit, hanchung
Differential Revision: https://reviews.llvm.org/D105329
Leonard Chan [Fri, 9 Jul 2021 20:41:48 +0000 (13:41 -0700)]
[compiler-rt][hwasan] Refactor kAliasRegionStart usage
This moves logic for setting kAliasRegionStart into hwasan_allocator.cpp
so other platforms that do not support aliasing mode will not need to define
kAliasRegionStart.
Differential Revision: https://reviews.llvm.org/D105725
Marco Elver [Mon, 12 Jul 2021 22:39:17 +0000 (15:39 -0700)]
sanitizer_common: Fix build for tests
It turns out that COMPILER_RT_TEST_COMPILER_CFLAGS is actually a string
that is being appended to and not a list.
Therefore, append the thread-safety flags to the string. Because CMake
separates list elements by ';' when turning into a string, also
substitute ';' with ' '.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D105829
Fangrui Song [Mon, 12 Jul 2021 22:46:20 +0000 (15:46 -0700)]
[Driver] Let -fno-integrated-as -gdwarf-5 use -fdwarf-directory-asm
While GNU as only allows the directory form of the .file directive for DWARF v5,
the integrated assembler prefers the directory form on all DWARF versions
(-fdwarf-directory-asm).
We currently set CC1 -fno-dwarf-directory-asm for -fno-integrated-as -gdwarf-5
which may cause the directory entry 0 and the filename entry 0 to be incorrect
(see D105662 and the example below). This patch makes -fno-integrated-as -gdwarf-5 use
-fdwarf-directory-asm as well.
```
cd /tmp/c
before
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -S -o - | grep '\.file.*0'
.file 0 "/tmp/c/e/a.c" md5 0x97e31cee64b4e58a4af8787512d735b6
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -c
% llvm-dwarfdump a.o | grep include_directories
include_directories[ 0] = "/tmp/c/e"
after
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -S -o - | grep '\.file.*0'
.file 0 "/tmp/c" "e/a.c" md5 0x97e31cee64b4e58a4af8787512d735b6
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -c
% llvm-dwarfdump a.o | grep include_directories
include_directories[ 0] = "/tmp/c"
```
Reviewed By: #debug-info, dblaikie, osandov
Differential Revision: https://reviews.llvm.org/D105835
Rob Suderman [Thu, 8 Jul 2021 22:17:15 +0000 (15:17 -0700)]
[mlir][tosa] Added shape propagation for TOSA pool operations.
Pool operations perform the same shape propagation. Included the shape
propagation and tests for these avg_pool2d and max_pool2d.
Differential Revision: https://reviews.llvm.org/D105665
Jon Roelofs [Mon, 12 Jul 2021 22:36:36 +0000 (15:36 -0700)]
[AArch64] Dump a little more info about unimplemented reg-to-reg copies. NFC
Eli Friedman [Mon, 12 Jul 2021 22:28:09 +0000 (15:28 -0700)]
[AArch64] Optimize overflow checks for [s|u]mul.with.overflow.i32.
Saves one instruction for signed, uses a cheaper instruction for
unsigned.
Differential Revision: https://reviews.llvm.org/D105770
Wouter van Oortmerssen [Mon, 12 Jul 2021 22:05:11 +0000 (15:05 -0700)]
[WebAssembly] Fixed LLD generation of 64-bit __wasm_init_memory
Differential Revision: https://reviews.llvm.org/D105849
Aart Bik [Fri, 9 Jul 2021 20:45:23 +0000 (13:45 -0700)]
[mlir][sparse] add restrictive versions of division support
Right now, we only accept x/c with nonzero c, since this
conceptually can be treated as a x*(1/c) conjunction for both
FP and INT as far as lattice computations go. The codegen
keeps the division though to preserve precise semantics.
See discussion:
https://llvm.discourse.group/t/sparse-tensors-in-mlir/3389/28
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D105731
Eli Friedman [Mon, 12 Jul 2021 20:06:23 +0000 (13:06 -0700)]
[SelectionDAG][RISCV] Support @llvm.vscale.i64() on 32-bit targets.
Not really useful on its own, but D105673 depends on it.
Differential Revision: https://reviews.llvm.org/D105840
Louis Dionne [Mon, 12 Jul 2021 21:26:16 +0000 (17:26 -0400)]
[libc++] ci: Properly target macOS nodes per-os
Louis Dionne [Mon, 12 Jul 2021 21:22:26 +0000 (17:22 -0400)]
[libc++] Add the 'os=macos' tag to macOS nodes to workaround lack of wildcard matching
Jim Ingham [Fri, 9 Jul 2021 01:08:11 +0000 (18:08 -0700)]
Revert "Revert "Reset the wakeup timeout when we re-enter the continue wait.""
This reverts commit
82a38837150099288a1262391ef43e1fd69ffde4.
The original version had a copy-paste error: using the Interrupt timeout
for the ResumeSynchronous wait, which is clearly wrong. This error would
have been evident with real use, but the interrupt is long enough that it
only caused one testsuite failure (in the Swift fork).
Anyway, I found that mistake and fixed it and checked all the other places
where I had to plumb through a timeout, and added a test with a short
interrupt timeout stepping over a function that takes 3x the interrupt timeout
to complete, so that should detect a similar mistake in the future.
Amy Kwan [Mon, 12 Jul 2021 21:19:15 +0000 (16:19 -0500)]
[PowerPC] Fix the splat immediate in PPCMIPeephole depending on if we have an Altivec and VSX splat instruction.
An assertion of the following can occur because Altivec and VSX splats use a different operand number for the immediate:
```
int64_t llvm::MachineOperand::getImm() const: Assertion `isImm() && "Wrong MachineOperand accessor"' failed.
```
This patch updates PPCMIPeephole.cpp assign the correct splat immediate.
Differential Revision: https://reviews.llvm.org/D105790
Louis Dionne [Thu, 8 Jul 2021 16:31:06 +0000 (12:31 -0400)]
[libc++][ci] Clean up the Docker image
- Remove symlinks that are not used anymore
- Stop installing GCC 10, which isn't tested anymore
Louis Dionne [Mon, 12 Jul 2021 20:25:29 +0000 (16:25 -0400)]
[libc++] Use 'os' tags to target Linux libc++ builders
Yaxun (Sam) Liu [Mon, 28 Jun 2021 15:19:43 +0000 (11:19 -0400)]
[clang] Document llvm options controlling pragma unroll
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D105035
Gus Smith [Mon, 12 Jul 2021 18:18:23 +0000 (18:18 +0000)]
[mlir][sparse] Add Merger unit tests (with gcc5 build fix)
This is a fix of https://reviews.llvm.org/D104956, which broke the gcc5 build.
We opt to use unit tests rather than check tests as the lattice/merger code is a small C++ component with a well-defined API. Testing this API via check tests would be far less direct and readable. In addition, as the check tests will only be able to test the API indirectly, the tests may break based on unrelated changes; e.g. changes in linalg.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D105828
Martin Storsjö [Wed, 7 Jul 2021 21:06:08 +0000 (21:06 +0000)]
[libcxx] [test] Fix spurious failures in the thread join test on Windows
Make sure that the detached thread has started up before exiting
the process.
This is exactly the same fix as D105592, with the same pattern
being present in a different test case.
Differential Revision: https://reviews.llvm.org/D105736
Felix Berger [Fri, 9 Jul 2021 20:58:01 +0000 (16:58 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Do not remove comments on new lines.
When deleting the copy assignment statement because copied variable is not used
only remove trailing comments on the same line.
Differential Revision: https://reviews.llvm.org/D105734
Reviewed-by: ymandel
Walter Erquinigo [Mon, 12 Jul 2021 18:46:36 +0000 (11:46 -0700)]
[vscode] fix ubsan problem in the progress event reporter
The error
UndefinedBehaviorSanitizer: undefined-behavior /Users/buildslave/jenkins/workspace/lldb-cmake-sanitized/llvm-project/lldb/tools/lldb-vscode/ProgressEvent.cpp:89:64 in
was found in https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-sanitized/1910/consoleFull#-
15641370498254eaf0-7326-4999-85b0-
388101f2d404
It turns out that we were not setting m_event_type when initializatin
and update case. The fix is very simple.
Differential Revision: https://reviews.llvm.org/D105832
Nikita Popov [Sun, 11 Jul 2021 14:54:03 +0000 (16:54 +0200)]
[Attributes] Determine attribute properties from TableGen data
Continuing from D105763, this allows placing certain properties
about attributes in the TableGen definition. In particular, we
store whether an attribute applies to fn/param/ret (or a combination
thereof). This information is used by the Verifier, as well as the
ForceFunctionAttrs pass. I also plan to use this in LLParser,
which also duplicates info on which attributes are valid where.
This keeps metadata about attributes in one place, and makes it
more likely that it stays in sync, rather than in various
functions spread across the codebase.
Differential Revision: https://reviews.llvm.org/D105780
zoecarver [Mon, 12 Jul 2021 20:09:55 +0000 (13:09 -0700)]
[libcxx][docs] Update the ranges status document to reflect the current state of the world.
Marks a few things as done. Marks a few things as in progress. Assigns a few things to me.
Wouter van Oortmerssen [Mon, 12 Jul 2021 20:06:54 +0000 (13:06 -0700)]
[WebAssembly] fix typo in range check for Asm locals
Louis Dionne [Mon, 12 Jul 2021 20:01:32 +0000 (16:01 -0400)]
[libc++] Encode the arch and OS in buildkite agent tags
Nikita Popov [Mon, 12 Jul 2021 19:59:29 +0000 (21:59 +0200)]
[Attributes] Remove duplicate attribute in typeIncompatible() (NFC)
InAlloca was listed twice, once as a normal attribute, once as a
type attribute.
Nikita Popov [Mon, 12 Jul 2021 19:25:46 +0000 (21:25 +0200)]
[Attributes] Replace doesAttrKindHaveArgument() (NFC)
This is now the same as isIntAttrKind(), so use that instead, as
it does not require manual maintenance. The naming is also more
accurate in that both int and type attributes have an argument,
but this method was only targeting int attributes.
I initially wanted to tighten the AttrBuilder assertion, but we
have some in-tree uses that would violate it.
Geoffrey Martin-Noble [Mon, 12 Jul 2021 19:14:11 +0000 (12:14 -0700)]
[Bazel] ignore build files under libcxx's copy of google-benchmark
https://github.com/llvm/llvm-project/commit/
5208ec5c66dc updated the
of google-benchmark under libcxx adding a BUILD.bazel file. This upsets
Bazel in our overlay configuration because it tries to interpret this
file.
Currently this is breaking the CI:
https://buildkite.com/llvm-project/upstream-bazel-rbe/builds/1828
Tested (same command the CI uses)
`bazel query //... + @llvm-project//... | xargs bazel test --config=generic-clang --config=rbe --test_output=errors --test_tag_filters=-nobuildkite --build_tag_filters=-nobuildkite`
Differential Revision: https://reviews.llvm.org/D105833
Louis Dionne [Mon, 12 Jul 2021 19:44:28 +0000 (15:44 -0400)]
[libc++] Exit from macos-ci-setup upon error
Simon Pilgrim [Mon, 12 Jul 2021 16:34:38 +0000 (17:34 +0100)]
[CostModel][X86] Adjust fptosi/fptoui SSE/AVX legalized costs based on llvm-mca reports.
Update (mainly) vXf32/vXf64 -> vXi8/vXi16 fptosi/fptoui costs based on the worst case costs from the script in D103695.
Move to using legalized types wherever possible, which allows us to prune the cost tables.
Thomas Johnson [Thu, 8 Jul 2021 23:45:45 +0000 (16:45 -0700)]
[ARC] Add disassembly for the conditioned move immediate instruction
This change is a step towards implementing codegen for __builtin_clz().
Full support for CLZ with a regression test will follow shortly.
Differential Revision: https://reviews.llvm.org/D105560
Louis Dionne [Mon, 12 Jul 2021 19:34:17 +0000 (15:34 -0400)]
[libc++][ci] Add arch and os tags to the macOS CI builders
Steven Wan [Mon, 12 Jul 2021 19:31:15 +0000 (15:31 -0400)]
[PowerPC][AIX] Fix Zero-width bit fields wrt MaxFieldAlign.
On AIX when there is a pragma pack, or pragma align in effect then zero-width bitfields should pad out to the end of the bitfield container but not increase the alignment requirements of the struct greater then the max field align.
Reviewed By: ZarkoCA
Differential Revision: https://reviews.llvm.org/D105635
Nikita Popov [Mon, 12 Jul 2021 19:08:41 +0000 (21:08 +0200)]
[Attributes] Simplify attribute sorting (NFCI)
It's not necessary to explicitly sort by enum/int/type attribute,
as the attribute kinds are already sorted this way. We can directly
sort by kind.
Nikita Popov [Mon, 12 Jul 2021 18:54:58 +0000 (20:54 +0200)]
[Attributes] Assert correct attribute constructor is used (NFCI)
Assert that enum/int/type attributes go through the constructor
they are supposed to use.
To make sure this can't happen via invalid bitcode, explicitly
verify that the attribute kind if correct there.
Vitaly Buka [Mon, 12 Jul 2021 18:58:01 +0000 (11:58 -0700)]
Revert "sanitizer_common: add simpler ThreadRegistry ctor"
Breaks https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-android
This reverts commit
6062c672bc5e560a4c3dc73741f9e82b39d08527.
This reverts commit
8e489b4b96e31cfb004e03cfa1393c425c504013.
Krzysztof Drewniak [Mon, 12 Jul 2021 16:36:27 +0000 (16:36 +0000)]
Add newline to fix documentation build
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D105825
Nikita Popov [Sat, 10 Jul 2021 16:36:00 +0000 (18:36 +0200)]
[Attributes] Make type attribute handling more generic (NFCI)
Followup to D105658 to make AttrBuilder automatically work with
new type attributes. TableGen is tweaked to emit First/LastTypeAttr
markers, based on which we can handle type attributes
programmatically.
Differential Revision: https://reviews.llvm.org/D105763
Geoffrey Martin-Noble [Mon, 12 Jul 2021 18:24:13 +0000 (11:24 -0700)]
[Bazel] Update configuration to HEAD
Bazel configuration updates for
https://github.com/llvm/llvm-project/commit/
75e5f0aac97d,
https://github.com/llvm/llvm-project/commit/
c282d55a3857, and
https://github.com/llvm/llvm-project/commit/
26e59cc19f86
Tested: `bazel test ... @llvm-project//...`
Differential Revision: https://reviews.llvm.org/D105830
Nikita Popov [Mon, 12 Jul 2021 18:28:28 +0000 (20:28 +0200)]
Revert "sanitizer_common: optimize memory drain"
This reverts commit
072669521456a369409cf9db30739a3fac740173.
This causes the following build failure with gcc 10.3.0:
/home/nikic/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h:114:31: error: declaration of ‘typedef class __sanitizer::MemoryMapper<__sanitizer::SizeClassAllocator64<Params> > __sanitizer::SizeClassAllocator64<Params>::MemoryMapper’ changes meaning of ‘MemoryMapper’ [-fpermissive]
114 | typedef MemoryMapper<ThisT> MemoryMapper;
Louis Dionne [Mon, 12 Jul 2021 17:15:34 +0000 (13:15 -0400)]
[libc++] Update Google benchmark to v 1.5.5
Jinsong Ji [Mon, 12 Jul 2021 17:04:54 +0000 (17:04 +0000)]
[PowerPC] Custom Lowering BUILD_VECTOR for v2i64 for P7 as well
The lowering for v2i64 is now guarded with hasDirectMove,
however, the current lowering can handle the pattern correctly,
only lowering it when there is efficient patterns and corresponding
instructions.
The original guard was added in D21135, and was for Legal action.
The code has evloved now, this guard is not necessary anymore.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D105596
Nico Weber [Mon, 12 Jul 2021 14:26:54 +0000 (10:26 -0400)]
[lld/mac] Implement -application_extension
Differential Revision: https://reviews.llvm.org/D105818
Thomas Lively [Mon, 12 Jul 2021 17:32:18 +0000 (10:32 -0700)]
[WebAssembly] Custom combines for f32x4.demote_zero_f64x2
Replace the clang builtin function and LLVM intrinsic for
f32x4.demote_zero_f64x2 with combines from normal SDNodes. Also add missing
combines for i32x4.trunc_sat_zero_f64x2_{s,u}, which share the same pattern.
Differential Revision: https://reviews.llvm.org/D105755
Dmitry Vyukov [Sun, 11 Jul 2021 13:12:24 +0000 (15:12 +0200)]
sanitizer_common: optimize memory drain
Currently we allocate MemoryMapper per size class.
MemoryMapper mmap's and munmap's internal buffer.
This results in 50 mmap/munmap calls under the global
allocator mutex. Reuse MemoryMapper and the buffer
for all size classes. This radically reduces number of
mmap/munmap calls. Smaller size classes tend to have
more objects allocated, so it's highly likely that
the buffer allocated for the first size class will
be enough for all subsequent size classes.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D105778