Vitaly Buka [Wed, 11 Jan 2023 01:41:36 +0000 (17:41 -0800)]
[AVR] Init member added by D140830
Matt Arsenault [Mon, 9 Jan 2023 23:21:11 +0000 (18:21 -0500)]
clang: Convert test to generated checks and opaque pointers
Matt Arsenault [Fri, 23 Dec 2022 20:45:34 +0000 (15:45 -0500)]
AMDGPU: Use constant and externally_initialized for block handle
The runtime initializes this.
Matt Arsenault [Mon, 9 Jan 2023 22:45:15 +0000 (17:45 -0500)]
AMDGPU: Fix opaque pointer handling for enqueued blocks, again
Weining Lu [Wed, 11 Jan 2023 01:33:03 +0000 (09:33 +0800)]
Revert "[CMake][LoongArch] Add LoongArch to LLVM_ALL_TARGETS so it is built by default"
This reverts commit
b5cb91fc1cb851dcc4d3dc82a19a9d56dd352350.
This commit causes expensive check fail:
https://lab.llvm.org/buildbot/#/builders/16/builds/41677.
Jennifer Yu [Mon, 9 Jan 2023 20:30:08 +0000 (12:30 -0800)]
This is to fix runtime problem for member data used in target region.
The problem is happened when base class member field is used in target
region , the size is wrong, cause runtime to fail. Currently the size of
calculation is depended on index of field, since field is in base class,
the calculation is wrong.
According OpenMP 5.2 148:21:
If the target construct is within a class non-static member function,
and a variable is an accessible data member of the object for which the
non-static data member function is invoked, the variable is treated as
if the this[:1] expression had appeared in a map clause with a map-type
of tofrom.
One way to fix this is emitting code to generate this[:1] instead only
when class has any base class.
Differential Revision: https://reviews.llvm.org/D141350
Jake Egan [Wed, 11 Jan 2023 00:51:00 +0000 (19:51 -0500)]
[NFC][AIX] Temporarily XFAIL test while investigating
Previous attempt to restrict this test to x86 and aarch64 targets only didn't work.
So XFAIL this test while investigating to get the AIX bot back to green.
Vasileios Porpodas [Tue, 10 Jan 2023 05:25:18 +0000 (21:25 -0800)]
[AsmWriter] Don't crash when printing a null operand bundle.
Differential Revision: https://reviews.llvm.org/D141415
yronglin [Wed, 11 Jan 2023 00:28:22 +0000 (08:28 +0800)]
[libc++] Use _LIBCPP_HIDE_FROM_ABI_VIRTUAL instead of _LIBCPP_INLINE_VISIBILITY attribute on virtual function
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D141388
Jonas Devlieghere [Wed, 11 Jan 2023 00:22:07 +0000 (16:22 -0800)]
[lldb] Only add lldb-framework-cleanup dependency to existing targets
The Xcode standalone build doesn't have the install-liblldb and
install-liblldb-stripped targets. Fix the resulting CMake error "Cannot
add target-level dependencies to non-existent target" by only adding the
dependency when the targets exist.
Joe Loser [Sun, 8 Jan 2023 22:07:19 +0000 (15:07 -0700)]
[libc++][test] Move `common_input_iterator` to `test_iterators.h`
There's a bit of duplication in use of `common_input_iterator` as noted in
https://reviews.llvm.org/D141216. Lift `common_input_iterator` into
`test_iterators.h`.
Differential Revision: https://reviews.llvm.org/D141238
Kirill Stoimenov [Tue, 10 Jan 2023 19:25:10 +0000 (19:25 +0000)]
[HWASAN] Implmented LSAN specifc thread support.
Implemented LSAN interface on HwasanThreadList and added os_id to __hwasan::Thread.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141143
Weining Lu [Tue, 10 Jan 2023 23:53:06 +0000 (07:53 +0800)]
[CMake][LoongArch] Add LoongArch to LLVM_ALL_TARGETS so it is built by default
This follows the [[ https://discourse.llvm.org/t/rfc-promoting-the-loongarch-backend-from-experimental-to-official/67506/ | RFC ]].
Follow-on commits will add appropriate release notes changes etc.
Submit this now and in a minimal form so there is reasonable time before
16.0.0 is branched to resolve any issues arising from e.g. the backend
being exposed on different compiler/sanitizer setups.
The current builder for LoongArch is on the [[ https://lab.llvm.org/staging/#/builders/236 | staging area ]].
Reviewed By: jyknight, MaskRay, echristo, myhsu, tstellar, arsenm
Differential Revision: https://reviews.llvm.org/D141191
Kirill Stoimenov [Tue, 10 Jan 2023 22:41:48 +0000 (22:41 +0000)]
[HWASAN] Added thread annotations to HwasanThreadList.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141438
Sebastian Peryt [Tue, 10 Jan 2023 23:15:42 +0000 (15:15 -0800)]
[LegacyPM] Port example pass SimplifyCFG to new PM
This is part of effort in removing -enable-new-pm flag.
As a prat of this effort one of example passes SimplifyCFG must
be ported to new PM which will allow to remove the flag
calls from the tests that are using this pass.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D137103
Craig Topper [Tue, 10 Jan 2023 23:32:11 +0000 (15:32 -0800)]
[RISCV] Remove RISCVSubtarget::getArchMinVLen()/getArchMaxVLen().
Fold them into their only callers, getRealMinVLen()/getArchMaxVLen().
It is unclear right now when these are needed so removing to discourage
misuse.
Between Zvl*b extensions, vector length command line options, and
vscale range, we have several ways to influence vector length. We
need to try to keep all code on the same page.
Alexander Yermolovich [Tue, 10 Jan 2023 23:14:47 +0000 (15:14 -0800)]
[DWARFLibrary] Add support to re-construct cu-index
According to DWARF5 specification and gnu specification for DWARF4 the offset
entry in the CU/TU Index is 32 bits. This presents a problem when
.debug_info.dwo in DWP file grows beyond 4GB. The CU Index becomes partially
corrupted.
This diff adds manual parsing of .debug_info.dwo/.debug_abbrev.dwo to
reconstruct CU index in general, and TU index for DWARF5. This is a work around
until DWARF6 spec is finalized.
Next patch will change internal CU/TU struct to 64 bit, and change uses as
necessary. The plan is to land all the patches in one go after all are approved.
This patch originates from the discussion in: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D137882
Vasileios Porpodas [Mon, 9 Jan 2023 23:18:55 +0000 (15:18 -0800)]
[AsmWriter] Don't crash when printing addrspace and the operand is null
This helps print instructions with detached operands in the debugger.
Differential Revision: https://reviews.llvm.org/D141343
Arthur Eubanks [Tue, 10 Jan 2023 23:12:03 +0000 (15:12 -0800)]
[gn build] Remove --rtlib=libgcc for Android builds
Recent Android NDKs don't ship with libgcc
Johannes Doerfert [Tue, 10 Jan 2023 21:51:28 +0000 (13:51 -0800)]
[OpenMP] Avoid running openmp-opt on dead functions
The Attributor has logic to run only on assumed live functions and this
is exposed to users now. OpenMP-opt will (mostly) ignore dead internal
functions now but run the same deduction as before if an internal
function is marked live.
This should lower compile time as we run on less code and delete more
code early on. For the full OpenMC module compiled with noinline and
JITed at runtime, we save ~25%, or ~10s on my machine during JITing.
Johannes Doerfert [Tue, 10 Jan 2023 22:01:00 +0000 (14:01 -0800)]
[OpenMP] Ensure AAHeapToShared is only looking at one function
When we collect and process allocations we did not verify the call
against the anchor scope / associated function. This should be done to
avoid processing calls multiple times and generally looking at calls not
in the AAs scope.
Johannes Doerfert [Tue, 10 Jan 2023 21:55:06 +0000 (13:55 -0800)]
[OpenMP] Disable ICV deduction by default.
This is not tested well and needs to be revisited in the future.
Arthur Eubanks [Tue, 10 Jan 2023 22:55:12 +0000 (14:55 -0800)]
[test] Use -verify-cfg-preserved=0 in new-pass-manager.ll
This matches other tests and makes this test less sensitive
Amir Aupov [Tue, 10 Jan 2023 22:21:39 +0000 (14:21 -0800)]
Revert "[perf-training] Check extension in findFilesWithExtension"
This reverts commit
1fbbf92e4fda3c7a3be1c02e1f7240135557846d.
Johannes Doerfert [Wed, 14 Dec 2022 01:51:21 +0000 (17:51 -0800)]
[Attributor] Improve use of dominating writes during reasoning
This resolves a recent regression introduced by a bug fix and allows us
to use dominating write information (formerly HasBeenWrittenTo
information) to skip potential interfering accesses.
Generally, there are two changes here:
1) If we have dominating writes they form a chain and we can look at the
least one to minimize the distance between the write and the (read)
access in question.
2) If such a least dominating write exists, we can ignore writes in
other functions as long as they cannot be reached from code between
this write and the (read) access in question.
We have all the tools available to make such queries and the positive
tests show the result. Note that the negative test from the bug fix is
still in tree and not affected.
As a side-effect, we can remove the (arbitrary) treshold now on the
number of interfering accesses since we do not iterate over dominating
ones anymore.
Siva Chandra Reddy [Tue, 10 Jan 2023 22:06:38 +0000 (22:06 +0000)]
[libc][NFC] Remove the now unused WrapperGen tool and tests.
Aviad Cohen [Tue, 10 Jan 2023 20:35:50 +0000 (12:35 -0800)]
[mlir][tosa] Remove redundant "tosa.transpose" operations
We can fold redundant Tosa::TransposeOp actions like identity tranpose/transpose(traspose).
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D140466
Blue Gaston [Sat, 7 Jan 2023 00:26:54 +0000 (17:26 -0700)]
[Sanitizer][Apple] Enable sanitizer common unittests for arm64 archs on Apple
This patch enables sanitizer common unit tests for arm64 architecture only on apple devices.
It also lowers the expected compression ratio for 64 bit machines. Unsure of justification of 130. On apple arm64 we're seeing this number comeout to 128.6
rdar://
101436019
Differential Revision: https://reviews.llvm.org/D141170
Krzysztof Drewniak [Mon, 9 Jan 2023 17:05:54 +0000 (17:05 +0000)]
[mlir][Index] Add index.mins and index.minu
Signed and unsigned minimum operations were missing from the Index
dialect and are needed to test integer range inference.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D141299
Krzysztof Drewniak [Mon, 9 Jan 2023 16:58:24 +0000 (16:58 +0000)]
[mlir][Arith] Fix bug in zero-extension range inference
D135089 extracted the extui code into a helper, but used fromSigned
instead of fromUnsigned.
Reviewed By: Mogball, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D141296
Philip Reames [Tue, 10 Jan 2023 20:20:50 +0000 (12:20 -0800)]
[RISCV] Add test coverage for TSO AMOs [nfc]
Rob Suderman [Tue, 10 Jan 2023 19:40:45 +0000 (11:40 -0800)]
[mlir][tosa] Add uint16 to TOSA type support
UInt16 is included as a required TOSA type for basic
operations. Added support as a TOSA Tensor.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D141341
Amaury Séchet [Wed, 4 Jan 2023 15:17:35 +0000 (15:17 +0000)]
[DAGCombine] fold (sext (sext_inreg x)) -> (sext (trunc x))
This fixes a regression introduced by D127115 in test/CodeGen/PowerPC/store-forward-be64.ll
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D140993
Johannes Reifferscheid [Tue, 10 Jan 2023 20:15:49 +0000 (21:15 +0100)]
Fix math.cbrt with vector and f16 arguments.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D141421
Johannes Doerfert [Sat, 17 Dec 2022 23:16:41 +0000 (15:16 -0800)]
Reapply "[Attributor] Introduce AA[Intra/Inter]Reachability"
This reverts commit
e425a4c45618fcfa8ffb13be4ddfaa5d28aa38f1 after the
memory leak has been fixed.
Joe Loser [Mon, 9 Jan 2023 23:51:26 +0000 (16:51 -0700)]
[libc++][utils] Remove unused import in `run.py`
`import sys` is unused in `libcxx/utils/run.py`: remove it.
Differential Revision: https://reviews.llvm.org/D141331
Joe Loser [Tue, 10 Jan 2023 03:13:44 +0000 (20:13 -0700)]
[libc++] Remove warning for `LIBCXX_SYSROOT`, `LIBCXX_TARGET_TRIPLE`, and `LIBCXX_GCC_TOOLCHAIN`
Support for these CMake variables has been a warning for a while now. The
comment indicates to just remove the warning message entirely as anyone impacted
had to have update to new mechanisms in order to use `libc++`. So, remove the
warning message.
Differential Revision: https://reviews.llvm.org/D141345
Joe Loser [Mon, 9 Jan 2023 22:37:11 +0000 (15:37 -0700)]
[llvm][ADT] Add deduction guides for `MutableArrayRef`
Similar to https://reviews.llvm.org/D140896, this adds deduction guides for the
counterpart of `ArrayRef`: `MutableArrayRef`. The update plan is the following:
1) Add deduction guides for `MutableArrayRef`.
2) Change uses in-tree from `makeMutableArrayRef` to use deduction guides
3) Mark `makeMutableArrayRef` as deprecated for some time before removing to
give downstream users time to update.
The deduction guides are similar to those provided by the `makeMutableArrayRef`
function templates, except we don't need one explicitly from `MutableArrayRef`.
Differential Revision: https://reviews.llvm.org/D141327
Sylvestre Ledru [Thu, 5 Jan 2023 14:16:10 +0000 (15:16 +0100)]
build: with -DCLANGD_ENABLE_REMOTE=ON, search for grpc++ dependencies too
Fixes: https://github.com/llvm/llvm-project/issues/59844
Differential Revision: https://reviews.llvm.org/D141047
Valentin Clement [Tue, 10 Jan 2023 19:57:39 +0000 (20:57 +0100)]
[flang] Load unlimited polymorphic box the same way as other
Unlimited polymorphic descriptor have a set size and can be loaded the
same way as polymorphic or monomorphic descriptors. The descriptor
code gen as been set in D138587.
Of course, the data hold by those descriptors have an unknown size
at compile time.
Depends on D141383
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141390
Amir Ayupov [Tue, 10 Jan 2023 02:07:26 +0000 (18:07 -0800)]
[perf-training] Check extension in findFilesWithExtension
`findFilesWithExtension` helper checks for `endswith(extension)` instead of
exactly matching the file extension. This causes it to match unrelated files,
for example, `.profdata` files while matching `.fdata` files:
http://157.230.108.44:8011/#/builders/56/builds/247
```
Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/prof.fdata.1124569.fdata...
Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/test/Frontend/Output/optimization-remark-with-hotness-new-pm.c.tmp.profdata...
```
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D141342
Matt Arsenault [Tue, 27 Dec 2022 15:37:52 +0000 (10:37 -0500)]
AMDGPU/GlobalISel: Widen s1 SGPR constants during regbankselect
To unambiguously interpret these as 32-bit SGPRs, we need to widen
these to s32. This was selecting to a copy from a 64-bit SGPR to a
32-bit SGPR for wave64.
Matt Arsenault [Fri, 23 Dec 2022 18:11:28 +0000 (13:11 -0500)]
clang: Fix handling of __builtin_elementwise_copysign
I realized the handling of copysign made no sense at all.
Only the type of the first operand should really matter, and
it should not perform a conversion between them.
Also fixes misleading errors and producing broken IR for
integers.
We could accept different FP types for the sign argument,
if the intrinsic permitted different types like the DAG node.
As it is we would need to insert a cast, which could have
other effects (like trapping on snan) which should not happen
for a copysign.
Johannes Doerfert [Sat, 7 Jan 2023 09:00:14 +0000 (01:00 -0800)]
[CallGraph][FIX] Ensure generic intrinsics are represented in the CG
Intrinsics have historically been excluded from the call graph with an
exception of 3 special ones added at some point. This meant that passes
depending on the call graph needed to handle intrinsics explicitly as
the underlying assumption, namely that intrinsics can't call or modify
things, doesn't hold. We are slowly moving away from special handling of
intrinsics, or at least towards explicitly checking what intrinsics we
want to handle differently.
This patch:
- Includes most intrinsics in the call graph. Debug intrinsics are
still excluded.
- Removes the special handling of intrinsics in the GlobalsAA pass.
- Removes the `IntrinsicInst::isLeaf` method.
Properly
Fixes: https://github.com/llvm/llvm-project/issues/52706
See also:
https://discourse.llvm.org/t/intrinsics-are-not-special-stop-pretending-i-mean-it/67545
Differential Revision: https://reviews.llvm.org/D14119
Jonas Devlieghere [Tue, 10 Jan 2023 19:21:09 +0000 (11:21 -0800)]
[lldb] Remove tools copied into LLDB.framework before install
CMake supports building Framework bundles for Apple platforms. We rely
on this functionality to create LLDB.framework. From CMake's
perspective, a framework is associated with a single target. In reality,
this is often not the case. In addition to a main library (liblldb) the
frameworks often contains associated resources that are their own CMake
targets, such as debugserver and lldb-argdumper.
When building and using the framework to run the test suite, those
binaries are expected to be in LLDB.framework. We have a function
(lldb_add_to_buildtree_lldb_framework) that copies those targets into
the framework.
When CMake installs a framework, it copies over the content of the
framework directory and "installs" the associated target. In addition to
copying the target, installing also means updating the RPATH. However,
the RPATH is only updated for the target associated with the framework.
Everything else is naively copied over, including executables or
libraries that have a different build and install RPATH. This means that
those tools need to have their own install rules.
If the framework is installed first, the aforementioned tools are copied
over with build RPATHs from the build tree. And when the tools
themselves are installed, the binaries get overwritten and the RPATHs
updated to the install RPATHs.
The problem is that CMake provides no guarantees when it comes to the
order in which components get installed. If those tools get installed
first, the inverse happens and the binaries get overwritten with the
ones that have build RPATHs.
lldb_add_to_buildtree_lldb_framework has a comment correctly stating
that those copied binaries should be removed before install. This patch
adds a custom target (lldb-framework-cleanup) that will be run before
the install phase and remove those files from LLDB.framework in the
build tree.
Differential revision: https://reviews.llvm.org/D141021
Casey Carter [Mon, 9 Jan 2023 22:54:44 +0000 (14:54 -0800)]
[libc++][test] Silence allocator conversion warnings
... by accepting `std::size_t` instead of `int` in `allocate` and `deallocate` functions.
Drive-by: To conform to the allocator requirements, the `Allocator` types in these tests need to have (1) converting constructors and (2) cross-specialization `==` that returns `true` at least for copies of the same allocator.
Differential Revision: https://reviews.llvm.org/D141334
Nemanja Ivanovic [Tue, 10 Jan 2023 19:12:54 +0000 (13:12 -0600)]
[AMDGPU] Fix big endian bots after 7c327c2
The pass that this test case is testing has host-endianness
dependencies. This fixes the pertinent one causing failures
on BE bots.
Matt Arsenault [Sat, 7 Jan 2023 00:02:10 +0000 (19:02 -0500)]
AMDGPU: Don't assert on printf of half
The comment says fields should be 4-byte aligned, so just pass through
after conversion to integer. The conformance test lacks any testing of
half.
Matt Arsenault [Mon, 9 Jan 2023 20:03:31 +0000 (15:03 -0500)]
LangRef: Add !associated to list of preserved global metadata
Matt Arsenault [Fri, 6 Jan 2023 19:02:24 +0000 (14:02 -0500)]
AMDGPU: Fix opaque pointer and other bugs in printf of constant strings
Strip pointer casts to get to the global. Fixes not respecting indexed
constant strings. Tolerate non-null terminated and empty strings.
Alexander Yermolovich [Tue, 10 Jan 2023 18:33:23 +0000 (10:33 -0800)]
[llvm][dwwarf] Change CU/TU index to 64-bit
Changed contribution data structure to 64 bit. I added the 32bit and 64bit
accessors to make it explicit where we use 32bit and where we use 64bit. Also to
make sure sure we catch all the cases where this data structure is used.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D139379
Peter Ammon [Tue, 10 Jan 2023 18:21:41 +0000 (19:21 +0100)]
tsan: fix a race when assigning ThreadSignalContext
The SigCtx function lazily allocates a ThreadSignalContext, and stores it
in the ThreadState. This function may be called by various interceptors and
the signal handler itself.
If SigCtx itself is interrupted by a signal, then (prior to this fix) there
was a possibility of allocating two ThreadSignalContexts. This not only
leaks, it fails to deliver the signal to the program's signal handler, as
the recorded signal is overwritten by the new ThreadSignalContext.
Fix this by using a CAS to swap in the ThreadSignalContext, preventing the
race. Add a test for this case.
Reviewed By: dvyukov, melver
Differential Revision: https://reviews.llvm.org/D140582
Mitch Phillips [Tue, 10 Jan 2023 18:29:49 +0000 (10:29 -0800)]
[GWP-ASan] Fix up bad report for in-page underflow w/ UaF
Complex scenario, but reports when there's both a use-after-free and
buffer-underflow that is in-page (i.e. doesn't touch the guard page)
ended up generating a pretty bad report:
'Use After Free at 0x7ff392e88fef (
18446744073709551615 bytes into a
1-byte allocation at 0x7ff392e88ff0) by thread 3836722 here:'
(note the 2^64-bytes-into-alloc, very cool and good!)
Fix up that case, and add a diagnostic about when you have both a
use-after-free and a buffer-overflow that it's probably a bogus report
(assuming the developer didn't *really* screw up and have a uaf+overflow
bug at the same time).
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D139885
Mitch Phillips [Tue, 10 Jan 2023 18:16:03 +0000 (10:16 -0800)]
[GWP-ASan] Fix atfork handlers being installed multiple times in tests
We incorrectly install the atfork handlers multiple times in the test
harness, tracked down to the default parameter used by
CheckLateInitIsOK. This manifested in a hang if running the tests with
--gtest_repeat={>=2} as the atfork handler ran multiple times, causing
double-lock and double-unlock, which on my machine hung.
Add a check-fail for this case as well to prevent this from happening
again (it was difficult to track down and is an easy mistake to make).
Differential Revision: https://reviews.llvm.org/D139731
Valery N Dmitriev [Sat, 7 Jan 2023 03:42:13 +0000 (19:42 -0800)]
[SLP] Do not ignore ordering for root node when it has in-tree uses.
When rooted with PHIs, a vectorization tree may have another node with PHIs
which have roots as their operands. We cannot ignore ordering information
for root in such a case.
Differential Revision: https://reviews.llvm.org/D141309
Philip Reames [Tue, 10 Jan 2023 17:51:56 +0000 (09:51 -0800)]
[RISCV] Avoid emitting hardware fences for singlethread fences
singlethread fences only synchronize with code running on the same hardware thread (i.e. signal handlers). Because of this, we need to prevent instruction reordering, but do not need to emit hardware fence instructions.
The implementation strategy here matches many other backends. The main motivation of this patch is to introduce the MEMBARRIER node and get some test coverage for it.
Differential Revision: https://reviews.llvm.org/D141311
Matt Arsenault [Fri, 6 Jan 2023 23:34:41 +0000 (18:34 -0500)]
AMDGPU: Don't insert ptrtoint for printf lowering
Matt Arsenault [Fri, 6 Jan 2023 23:23:53 +0000 (18:23 -0500)]
AMDGPU: Stop trying to specially handle vector stores in printf lowering
This was broken for 1 element vectors and trying to create invalid
casts. We can directly store any type just fine, so don't bother with
this buggy conversion logic.
Matt Arsenault [Sat, 7 Jan 2023 21:11:42 +0000 (16:11 -0500)]
clang/AMDGPU: Add missing tests for some builtin
These were tested under opencl but need hip testing for the potential
addrspacecasts.
Matt Arsenault [Sat, 7 Jan 2023 13:39:15 +0000 (08:39 -0500)]
AMDGPU: Move intrinsic definition point
This was incorrectly listed under the block for backend internal
intrinsics only.
Matt Arsenault [Sat, 7 Jan 2023 13:28:17 +0000 (08:28 -0500)]
AMDGPU: Set some more attributes on intrinsics
Heejin Ahn [Sun, 18 Dec 2022 00:33:22 +0000 (16:33 -0800)]
[WebAssembly][LiveDebugValues] Handle target index defs
This adds the missing handling for defs for target index operands, as is
already done for registers.
There are two kinds of target indices: local indices and stack operands.
- Locals are something similar to registers in Wasm-land. For local
indices, we can check for local-defining instructions (`local.set` or
`local.tee`).
- Wasm is a stack machine, so we have values in certain Wasm value stack
location, which change when Wasm instructions produce or consume
values. So basically any value-producing instrucion, i.e., instruction
with defs, can change values in the Wasm stack. But I think we don't
need to worry about this here, because `WebAssemblyDebugFixup`, which
runs right before this analysis, makes sure to insert terminating
`DBG_VALUE $noreg` instructions whenever a stack value gets popped.
After `WebAssemblyDebugFixup`, there shouldn't be any `DBG_VALUE`s for
stack operands that don't have a terminating `DBG_VALUE $noreg` within
the same BB.
So this CL only works on `DBG_VALUE`s for locals. When we encounter a
`local.set` or `local.tee` instructions, we delete `DBG_VALUE`s for
those target index locations from the open range set, so they will not
be availble in `OutLocs`. For example,
```
bb.0:
successors: %bb.1
DBG_VALUE target-index(wasm-local) + 2, $noreg, "var", ...
...
local.set 2 ...
bb.1:
; predecessors: %bb.0
; We shouldn't add `DBG_VALUE target (wasm-local) + 2 here because
; it was killed by 'local.set' in bb.0
```
After disabling register coalescing at -O1, the average PC ranges
covered for Emscripten core benchmarks is currently 20.6% in the LLVM
tot. After applying D138943 and this CL, the coverage goes up to 57%.
This also enables LiveDebugValues analysis in the Wasm pipeline by
default.
Reviewed By: dschuff, jmorse
Differential Revision: https://reviews.llvm.org/D140373
Heejin Ahn [Wed, 21 Sep 2022 21:48:34 +0000 (14:48 -0700)]
[WebAssembly] Use LiveDebugValues analysis
This enables `LiveDebugValues` analysis for Wasm. `DBG_VALUE`s expire at
the end of a BB, and this is the analysis extends their lifetime when
possible, greatly increasing the coverage of variable debug info.
Specifically, this removes the current constraint that this analysis is
only used with physical registers, which was first introduced in D18421,
because Wasm uses only virtual registers. I don't think there's anything
inherent in this analysis that only applies to physical registers; it
was just because all targets using this analysis ran this at the end of
their compiliation pipeline, at which point all their vregs had been
allocated, and Wasm's debug info infrastructure was not really set up
yet, so it was not using it.
This adds supports to Wasm-specific target-index operands, defined in
https://github.com/llvm/llvm-project/blob/
2166d9529a60d1cdedb733d2e4134c971f0969ec/llvm/lib/Target/WebAssembly/WebAssembly.h#L87-L100.
Among these, `TI_LOCAL`, `TI_LOCAL_INDIRECT`, and `TI_OPERAND_STACK` are
used by Wasm `DBG_VALUE` instructions.
This does not yet handle mutable target indices, i.e., this does not
terminate a `DBG_VALUE` for a local index when we encounter a new
`local.set` or `local.tee`. It will be implemented as a follow-up.
Reviewed By: dschuff, jmorse
Differential Revision: https://reviews.llvm.org/D138943
Mark de Wever [Sat, 24 Dec 2022 12:33:21 +0000 (13:33 +0100)]
[NFC][libc++][test] Improves code reuse.
This applies D140115 to the new tuple tests.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D140650
Chris Cotter [Tue, 10 Jan 2023 17:37:05 +0000 (17:37 +0000)]
[NFC] [clang-tools-extra] Alphabetize clang-tidy release notes
Alphabetize order of clang-tidy release notes, and fix `:doc:` link.
Reviewed By: Eugene.Zelenko
Differential Revision: https://reviews.llvm.org/D141391
Kirill Stoimenov [Tue, 10 Jan 2023 16:57:38 +0000 (16:57 +0000)]
[HWASAN] Added empty WordIsPoisoned for LSAN support.
Currently it is just an empty implementation to allow the project to link.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141147
esmeyi [Tue, 10 Jan 2023 17:32:13 +0000 (12:32 -0500)]
[XCOFF] Fix the offset error of dwarf sections caused by D137819.
chenglin.bi [Tue, 10 Jan 2023 17:28:43 +0000 (01:28 +0800)]
[DAGCombiner] Fix issue with rot chain pattern
faa35fc87370 fix the case of negative input shift. But when `c1`, `c2` is not the same side, it will also cause negative shift amount.
And that negative shift amount can't normalize by urem. So add one more bit size to normalize the last shift amount.
Fix: https://github.com/llvm/llvm-project/issues/59898
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D141363
chenglin.bi [Tue, 10 Jan 2023 17:24:34 +0000 (01:24 +0800)]
Revert "[LSR] Hoist IVInc to loop header if its all uses are in the loop header"
The original commit seems to cause a regression in numba test.
This reverts commit
b1b4758e7f4b2ffe1faa28b00eb037832e5d26a7.
serge-sans-paille [Tue, 10 Jan 2023 10:49:15 +0000 (11:49 +0100)]
[llvm] Declare llvm::makeArrayRef as obsolete
Also cleans up a few remaining references.
This is the final commit for the series started by
https://reviews.llvm.org/D140896
Alex Brachet [Tue, 10 Jan 2023 16:41:28 +0000 (16:41 +0000)]
[libc] Fix -Wimplicit-int-conversion warnings
Differential Revision: https://reviews.llvm.org/D140492
Tobias Gysi [Tue, 10 Jan 2023 16:13:33 +0000 (17:13 +0100)]
[mlir][llvm] Improve error messages during LLVM IR import.
Use the module location instead of unknown location if the imported
LLVM IR module does not have more precise debug information.
Additionally, use the diagMD function to print the metadata instead
of just the metadata kind if the import fails.
Reviewed By: definelicht
Differential Revision: https://reviews.llvm.org/D141357
Valentin Clement [Tue, 10 Jan 2023 16:08:33 +0000 (17:08 +0100)]
[flang] Fix emboxing when input type is directly a record type
In some fir.embox cases as shown in the test, the type descriptor
was not correctly found and the descriptor was populated with a null in the
addendum. This patch fixes this issue.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141383
Chris Cotter [Tue, 10 Jan 2023 15:23:32 +0000 (15:23 +0000)]
[clang-tidy] Match derived types in in modernize-loop-convert
This patch allows clang-tidy to replace traditional for-loops where the
container type inherits its `begin`/`end` methods from a base class.
Test plan: Added unit test cases that confirm the tool replaces the new
pattern.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D140307
Nikita Popov [Tue, 10 Jan 2023 15:20:44 +0000 (16:20 +0100)]
[Verifier] Convert tests to opaque pointers (NFC)
Some tests are removed because they check conditions that
are not relevant with opaque pointers.
Yitzhak Mandelbaum [Mon, 9 Jan 2023 22:54:53 +0000 (22:54 +0000)]
[clang][dataflow] Fix 2 bugs in `MemberExpr` interpretation.
There were two (small) bugs causing crashes in the analysis. This patch fixes both of them.
1. An enum value was accessed as a class member. Now, the engine gracefully
ignores such member expressions.
2. Field access in `MemberExpr` of struct/class-typed global variables. Analysis
didn't interpret fields of global vars, because the vars were initialized before
the fields were added to the "allowlist". Now, the allowlist is set _before_
init of globals.
Differential Revision: https://reviews.llvm.org/D141384
Aaron Ballman [Tue, 10 Jan 2023 15:43:33 +0000 (10:43 -0500)]
Remove a stale FIXME comment; NFC
Also regenerates the AST matcher documentation. This matcher is tested
in TEST(HasImplicitDestinationType, MatchesSimpleCase) and
TEST(HasImplicitDestinationType, DoesNotMatchIncorrectly) in
ASTMatchersTraversalTest.cpp.
Alex Brachet [Tue, 10 Jan 2023 15:37:58 +0000 (15:37 +0000)]
Reland: "[libc] Templatize str{,n}cmp"
This will be used to implement the case insensitive str{,n}casecmp
This was initially reverted because it broke tests on arm platforms.
Unfortunately, it didn't break on my arm machine, but I suspect the
problem was the old comparator returned char and not int.
Differential Revision: https://reviews.llvm.org/D141235
Aaron Ballman [Tue, 10 Jan 2023 15:38:07 +0000 (10:38 -0500)]
Fix the documentation for the hasBody AST matcher
The problem was whitespace between the comment and the code for the
matcher. Rather than fix the script, I went the easier route and
removed the offending newline. If this problem comes up again though,
we should consider making the script less fragile.
Sanjay Patel [Tue, 10 Jan 2023 14:54:54 +0000 (09:54 -0500)]
[InstCombine] remove zext-of-icmp fold that may conflict with other folds
This bit-hack transform would cause the new test to infinite loop
after
21d3871b7c90f85b3ae.
The deleted transform has existed for a very long time,
but the profitable parts appear to be handled by other
folds now. This fold could replace 2 instructions with
4 instructions, so it was always in danger of going
overboard.
No tests regress by removing the whole thing.
Nico Weber [Tue, 10 Jan 2023 15:20:39 +0000 (10:20 -0500)]
[lld] Fix comment typos to cycle bots
Aaron Ballman [Tue, 10 Jan 2023 14:53:19 +0000 (09:53 -0500)]
Correct documentation for the hasBody() AST matcher; NFC
Note, when regenerating the documentation for this change, no changes
were made to the HTML file. There is an existing bug with the AST
matcher python script that fails to handle hasBody() specifically. So
this commit is to correct the internal documentation but another change
will be needed to fix the public documentation.
Aaron Ballman [Tue, 10 Jan 2023 14:51:57 +0000 (09:51 -0500)]
Update dump_ast_matchers.py to Python 3
Also regenerates the documentation and fixed a validation diagnostic
about use of 'is' vs '=='.
Matthias Springer [Tue, 10 Jan 2023 14:30:49 +0000 (15:30 +0100)]
[mlir] Fix worklist bug in MultiOpPatternRewriteDriver
When `strict = true`, only pre-existing and newly-created ops are rewritten and/or folded. Such ops are stored in `strictModeFilteredOps`.
Newly-created ops were previously added to `strictModeFilteredOps` after calling `addToWorklist` (via `GreedyPatternRewriteDriver::notifyOperationInserted`). Therefore, newly-created ops were never added to the worklist.
Also fix a test case that should have gone into an infinite loop (`test.replace_with_new_op` was replaced with itself, which should have caused the op to be rewritten over and over), but did not due to this bug.
Differential Revision: https://reviews.llvm.org/D141141
Yitzhak Mandelbaum [Mon, 9 Jan 2023 20:13:16 +0000 (20:13 +0000)]
[clang][dataflow][NFC] Refine names and comments for field filtering.
Tweaks elements of the new API for filtering the set of modeled fields.
Differential Revision: https://reviews.llvm.org/D141319
Shoaib Meenai [Sat, 7 Jan 2023 07:35:15 +0000 (23:35 -0800)]
[libc++] Fix aligned_alloc usage for Android
Android only provides this function on API 28+; fix libc++ builds when
targeting older API levels.
Reviewed By: arichardson, #libc, philnik
Differential Revision: https://reviews.llvm.org/D141184
Dinar Temirbulatov [Tue, 10 Jan 2023 14:23:29 +0000 (14:23 +0000)]
Move isAllInactivePredicate and isAllActivePredicate definition upwards, NFC
Andrew Ng [Tue, 10 Jan 2023 14:03:48 +0000 (14:03 +0000)]
[lld][COFF] Fix bug causing assertion in Chunk::setAlignment
Reinstate use of FakeSection class to avoid constructing SectionChunk
from unintialised coff_section in FakeSectionChunk constructor.
Issue was caused by commit
5a58b19f9c93f3ac51bcde318508131ae78aa10c,
"[LLD] Remove global state in lld/COFF".
Yitzhak Mandelbaum [Tue, 27 Dec 2022 17:34:30 +0000 (17:34 +0000)]
[clang][dataflow] Unify `TransferOptions` and `DataflowAnalysisContext::Options`.
Merges `TransferOptions` into the newly-introduced
`DataflowAnalysisContext::Options` and removes explicit parameter for
`TransferOptions`, relying instead on the common options carried by the analysis
context. Given that there was no intent to allow different options between calls
to `transfer`, a common value for the options is preferable.
Differential Revision: https://reviews.llvm.org/D140703
Jay Foad [Tue, 10 Jan 2023 14:13:16 +0000 (14:13 +0000)]
[AMDGPU] Add GFX10/GFX11 wave64 test coverage in huge-private-buffer.ll
Jens Massberg [Tue, 10 Jan 2023 11:20:09 +0000 (12:20 +0100)]
Avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.
Differential Revision: https://reviews.llvm.org/D141368
Jay Foad [Tue, 10 Jan 2023 14:06:59 +0000 (14:06 +0000)]
[AMDGPU] Fix duplicate -verify-machineinstrs option
Tomas Matheson [Tue, 6 Dec 2022 11:18:16 +0000 (11:18 +0000)]
[AArch64] Comprehensive tests for atomic operations
There are a lot of variants of atomic operations, and AArch64 has several
distinct options to codegen them, and does different things depending on
available features, architecture version and optimisation level. The current
testing for atomic operations has been added gradually over time and does not
give full coverate. Given how complex the codegen for atomic operations is, it
is valuable to cover the entire parameter space, i.e. test them all. The
resulting set of tests serve also as a reference for how each is codegened.
In order to keep the test files readable and avoid constant updating for
unrelated codegen changes, the test outputs are filtered to only include the
relevant instructions. This shows for each operation and feature which codegen
approach is taken (e.g. ll/sc loop, atomic instruction, library call).
The following parameter space is tested:
- feature: +lse, +rcpc, etc
- optimisation level: O0, O1 (covers GISel and SelectionDAG)
- atomic instruction: load, store, cmpxchg, atomirmw*
- size: i8, i16, i32, i64, i128
- aligned/unaligned accesses
- endianness: big, little
- atomic ordering: release, acquire, etc
- load atomic only: const/non-const
- cmpxchg only: weak/strong
- atomicrmw: update operation (add, sub, etc)
Notably not covered:
- volatility: there should be no difference between volatile/non-volatile
- atomicrmw fadd/fsub
The files are split by triple, LLVM instruction, and feature. This makes it
easy to diff between features and endianness for a given instruction.
The file that generates the tests is included.
There are 70 test files with an average of 2800 lines each.
Differential Revision: https://reviews.llvm.org/D141064
Alex Zinenko [Tue, 10 Jan 2023 12:19:53 +0000 (12:19 +0000)]
[mlir] verify that transform ops have memory effects
Add a verifier to the TransformOpInterface ensuring that operations
implementing the interface define memory effects on their operands and
results.
Add the missing effects to TileToForeachThreadOp, specifically for
operands that were added at a later version of the op without modifying
`getEffects` accordingly.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D141371
Ganesh Gopalasubramanian [Tue, 10 Jan 2023 13:41:25 +0000 (19:11 +0530)]
Revert "[X86] Add RMPQUERY to SNP instructions"
This reverts commit
313b747c5bf293aa86caf0da57b978a9758cd57b.
It wasn't reviwed as yet.
Ganesh Gopalasubramanian [Tue, 10 Jan 2023 13:31:12 +0000 (19:01 +0530)]
[X86] Add RMPQUERY to SNP instructions
Tobias Gysi [Tue, 10 Jan 2023 13:16:38 +0000 (14:16 +0100)]
[mlir][llvm] Call the instruction builders from a static method (NFC).
Extract a static method to call the MLIR builders that translate LLVM IR
instructions to MLIR LLVM dialect operations. This change ensures the
MLIR builders have to use the moduleImport argument rather than calling
the import methods directly. As a result, both the intrinsic and the
instruction MLIR builders have to use a moduleImport argument and none
of them has direct access to private moduleImport methods. The revision
thus enforces consistent MLIR builder implementations for instructions
and intrinsics.
The revision also moves parseDataLayoutAlignment closer to its use.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D141265
Sam McCall [Mon, 9 Jan 2023 19:36:05 +0000 (20:36 +0100)]
[Support] avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.
Differential Revision: https://reviews.llvm.org/D141312
Sam McCall [Tue, 10 Jan 2023 09:51:34 +0000 (10:51 +0100)]
[AST] include decls owned by FriendDecl in -ast-dump
Differential Revision: https://reviews.llvm.org/D141362
Jay Foad [Tue, 10 Jan 2023 12:02:55 +0000 (12:02 +0000)]
[AMDGPU] Add GFX11 test coverage for FeatureBackOffBarrier