platform/upstream/llvm.git
16 months ago[libc] Test the RPC interface with multiple blocks
Joseph Huber [Mon, 17 Apr 2023 12:09:59 +0000 (07:09 -0500)]
[libc] Test the RPC interface with multiple blocks

The RPC interface can support multiple independent clients. This support
currently only supports many single-thread warps / workgroups
coordinating over a single lock. This patch uses the support added in
the previous patch to test the RPC interface with multiple blocks.

Note that this does not work with multiple threads currently because of
the effect of warps / workgroups executing in lockstep incorrectly. This
will be added later.

Depends on D148485

Reviewed By: lntue, sivachandra

Differential Revision: https://reviews.llvm.org/D148486

16 months ago[libc] Add a test to directly stimulate the RPC interface
Joseph Huber [Fri, 14 Apr 2023 14:24:00 +0000 (09:24 -0500)]
[libc] Add a test to directly stimulate the RPC interface

Currently, the RPC interface with the loader is only tested if the other
tests fail. This test adds a direct test that runs a simple integer
increment over the RPC handshake 10000 times.

Depends on https://reviews.llvm.org/D148288

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D148342

16 months ago[libc] Update RPC interface for system utilities on the GPU
Joseph Huber [Fri, 14 Apr 2023 02:27:51 +0000 (21:27 -0500)]
[libc] Update RPC interface for system utilities on the GPU

This patch reworks the RPC interface to allow more generic memory
operations using the shared better. This patch decomposes the entire RPC
interface into opening a port and calling `send` or `recv` on it.

The `send` function sends a single packet of the length of the buffer.
The `recv` function is paired with the `send` call to then use the data.
So, any aribtrary combination of sending packets is possible. The only
restriction is that the client initiates the exchange with a `send`
while the server consumes it with a `recv`.

The operation of this is driven by two independent state machines that
tracks the buffer ownership during loads / stores. We keep track of two
so that we can transition between a send state and a recv state without
an extra wait. State transitions are observed via bit toggling, e.g.

This interface supports an efficient `send -> ack -> send -> ack -> send`
interface and allows for the last send to be ignored without checking
the ack.

A following patch will add some more comprehensive testing to this interface. I
I informally made an RPC call that simply incremented an integer and it took
roughly 10 microsends to complete an RPC call.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D148288

16 months ago[mlir][sparse] support iteration over compressed-hi dimension level in loop emitter
Peiming Liu [Tue, 18 Apr 2023 22:05:31 +0000 (22:05 +0000)]
[mlir][sparse] support iteration over compressed-hi dimension level in loop emitter

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D148668

16 months ago[LIBC] Fix incorrect behavior with pthread_key_t when value was nullptr
Noah Goldstein [Thu, 20 Apr 2023 00:33:32 +0000 (19:33 -0500)]
[LIBC] Fix incorrect behavior with pthread_key_t when value was nullptr

We should not call destructor if value is nullptr.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D148291

16 months agoAdd missing header guards so the modules build will succeed.
Jim Ingham [Thu, 20 Apr 2023 00:23:43 +0000 (17:23 -0700)]
Add missing header guards so the modules build will succeed.

16 months ago[gn build] Port 87cec865979c
LLVM GN Syncbot [Thu, 20 Apr 2023 00:13:38 +0000 (00:13 +0000)]
[gn build] Port 87cec865979c

16 months ago[gn] Use clang/utils/bundle_resources.py for clang-pseudo too
Nico Weber [Wed, 19 Apr 2023 18:06:53 +0000 (14:06 -0400)]
[gn] Use clang/utils/bundle_resources.py for clang-pseudo too

See https://reviews.llvm.org/D146591#4281023 -- optimistically
assuming that gets done :)

16 months agoValueTracking: uitofp/sitofp cannot return denormal results
Matt Arsenault [Thu, 13 Apr 2023 14:53:27 +0000 (10:53 -0400)]
ValueTracking: uitofp/sitofp cannot return denormal results

16 months agoValueTracking: Handle sign bit of constrained sitofp/uitofp
Matt Arsenault [Thu, 13 Apr 2023 14:15:15 +0000 (10:15 -0400)]
ValueTracking: Handle sign bit of constrained sitofp/uitofp

This is for parity with CannotBeNegativeZero which is close to
droppable.

16 months agoValueTracking: Implement computeKnownFPClass for fdiv for nan handling
Matt Arsenault [Sun, 9 Apr 2023 11:20:25 +0000 (07:20 -0400)]
ValueTracking: Implement computeKnownFPClass for fdiv for nan handling

16 months agoValueTracking: Add baseline tests for computeKnownFPClass fdiv handling
Matt Arsenault [Wed, 12 Apr 2023 14:48:33 +0000 (10:48 -0400)]
ValueTracking: Add baseline tests for computeKnownFPClass fdiv handling

16 months agoValueTracking: Fix backwards handling of fpclass assumes
Matt Arsenault [Tue, 11 Apr 2023 18:03:42 +0000 (14:03 -0400)]
ValueTracking: Fix backwards handling of fpclass assumes

This was a bit confused because nofpclass expresses the opposite
from what an assume of class expresses. We need to assume
the intersection of assumed classes, which also needs to be inverted
to convert to nofpclass.

16 months agoAttributor: Add baseline tests for nofpclass changes
Matt Arsenault [Tue, 11 Apr 2023 18:20:05 +0000 (14:20 -0400)]
Attributor: Add baseline tests for nofpclass changes

16 months agoValueTracking: Add more tests for trunc handling in computeKnownFPClass
Matt Arsenault [Mon, 17 Apr 2023 14:15:30 +0000 (10:15 -0400)]
ValueTracking: Add more tests for trunc handling in computeKnownFPClass

16 months agoValueTracking: Add baseline test for computeKnownFPClass for sqrt
Matt Arsenault [Sun, 9 Apr 2023 02:38:59 +0000 (22:38 -0400)]
ValueTracking: Add baseline test for computeKnownFPClass for sqrt

16 months ago[TSan] Fix comment describing shadow memory layout
Julian Lettner [Tue, 18 Apr 2023 17:39:00 +0000 (10:39 -0700)]
[TSan] Fix comment describing shadow memory layout

Differential Revision: https://reviews.llvm.org/D148648

16 months ago[lldb] Fix bug to update process public run lock with process state
Med Ismail Bennani [Wed, 19 Apr 2023 23:53:19 +0000 (16:53 -0700)]
[lldb] Fix bug to update process public run lock with process state

This patch should address an issue that caused the process public run
lock to not be updated during a process launch/attach when the process
stops.

That caused the public run lock to report its state as running while the
process state is stopped. This prevents the users to interact with the
process (through the command line or via the SBAPI) since it's
considered still running.

To address that, this patch refactors the name of the internal hijack
listeners to a specific pattern `lldb.internal.<action>.hijack` that
are used to ensure that we've attached to or launched a process successfully.

Then, when updating the process public state, after updating the state
value, if the process is not hijacked externally, meaning if the process
doens't have a hijack listener that matches the internal hijack
listeners pattern, we can update the public run lock accordingly.

rdar://108283017

Differential Revision: https://reviews.llvm.org/D148400

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
16 months agoRevert "Revert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain...
MalavikaSamak [Wed, 19 Apr 2023 23:42:15 +0000 (16:42 -0700)]
Revert "Revert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages""

This reverts commit 7bf5f4692ad6f9ba2d5c155f6b630049bb59876f and adding -frtti flag to support PS4/PS5 builds.

16 months ago[CMake] Reduce deps
NAKAMURA Takumi [Wed, 19 Apr 2023 23:33:34 +0000 (08:33 +0900)]
[CMake] Reduce deps

16 months ago[Bazel] Introduce "//clang:bundle_resources" for D146591
NAKAMURA Takumi [Wed, 19 Apr 2023 23:23:56 +0000 (08:23 +0900)]
[Bazel] Introduce "//clang:bundle_resources" for D146591

16 months ago[BOLT][NFC] Remove exec permission from some tests
Nathan Sidwell [Wed, 19 Apr 2023 19:53:52 +0000 (15:53 -0400)]
[BOLT][NFC] Remove exec permission from some tests

These files unnecessarily had execute permission.

16 months ago[BOLT] Add bolt-runtime requirement to tests
Nathan Sidwell [Wed, 19 Apr 2023 19:53:17 +0000 (15:53 -0400)]
[BOLT] Add bolt-runtime requirement to tests

These tests rely on the X86 runtime, add the REQUIRES.

Differential Revision: https://reviews.llvm.org/D148737

16 months ago[libc] Fix strtod hex exponent overflow bug
Michael Jones [Mon, 17 Apr 2023 17:30:28 +0000 (10:30 -0700)]
[libc] Fix strtod hex exponent overflow bug

Same issue as was fixed in commit 3d95323, but for hexadecimal floats.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D148545

16 months ago[libc][math] Remove the unused dp_trig target and tests.
Siva Chandra Reddy [Wed, 19 Apr 2023 23:11:10 +0000 (23:11 +0000)]
[libc][math] Remove the unused dp_trig target and tests.

16 months agoRevert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffe...
MalavikaSamak [Wed, 19 Apr 2023 23:08:55 +0000 (16:08 -0700)]
Revert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages"

This reverts commit 777eb4bcfc3265359edb7c979d3e5ac699ad4641.

16 months ago[CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_r...
Butta [Wed, 19 Apr 2023 22:55:05 +0000 (15:55 -0700)]
[CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_rpath()

If any LLVM subprojects are built separately, the LLVM build directory
LLVM_LIBRARY_DIR is added to both the build and install runpaths in
llvm_setup_rpath(), which is incorrect when installed. Separate the
build and install runpaths on ELF platforms and finally remove the
incorrect call to this function for compiler-rt, as previously attempted
in 21c008d5a5b. That prior attempt was reverted in 959dbd1761c, where it
was said to break the build on macOS and Windows, so I made sure to keep
those platforms the same.

Two examples of incorrect runpaths that are currently added, one from
the latest LLVM 16 toolchain for linux x86_64:

  > readelf -d clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.*so | ag "File:|runpath"
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.dyndd.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.hwasan_aliases.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.hwasan.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.memprof.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.scudo_standalone.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.tsan.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.ubsan_minimal.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]

Another is in the Swift toolchain, which builds lldb separately:

  > readelf -d swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/{bin/lldb*,lib/liblldb.so}|ag "File:|runpath"
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb-argdumper
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb-server
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/lib/liblldb.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib:/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:$ORIGIN/../lib/swift/linux]

This patch should fix this problem of absolute paths from the build host
leaking out into the toolchain's runpaths.

Differential revision: https://reviews.llvm.org/D146918

16 months ago[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages
MalavikaSamak [Wed, 19 Apr 2023 22:52:12 +0000 (15:52 -0700)]
[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages

This patch handles unevaluated contexts to ensure no warnings are produced by the machinery
for buffer access made within an unevaluated contexts. However, such accesses must be
considered by a FixableGadget and produce the necessary fixits.

Reviewed by: NoQ, ziqingluo-90, jkorous

Differential revision: https://reviews.llvm.org/D144905

16 months ago[flang][openacc] Add basic lowering to new data operations for acc.enter_data
Valentin Clement [Wed, 19 Apr 2023 22:52:24 +0000 (15:52 -0700)]
[flang][openacc] Add basic lowering to new data operations for acc.enter_data

This is an initial patch that lowers acc.enter_data copyin/create/attach
clauses to the newly added data operand operations. Follow up patches will
add support for array section and derived type and derived type component
as well as support in other data operation.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148721

16 months ago[libc][Obvious] Remove an unused "using" declaration.
Siva Chandra Reddy [Wed, 19 Apr 2023 22:42:25 +0000 (22:42 +0000)]
[libc][Obvious] Remove an unused "using" declaration.

16 months ago[TableGen] Use heap allocated arrays instead of vectors for TreePatternNode::Types...
Craig Topper [Wed, 19 Apr 2023 22:22:42 +0000 (15:22 -0700)]
[TableGen] Use heap allocated arrays instead of vectors for TreePatternNode::Types and ResultPerm. NFC

These vectors are resized in the constructor and never change size.
We can manually allocate two arrays instead.

This reduces the size of TreePatternNode by removing the
unneeded capacity end pointer fields from the std::vector.

16 months agoRevert "[cmake] Explicitly disable download step"
Vitaly Buka [Wed, 19 Apr 2023 22:13:23 +0000 (15:13 -0700)]
Revert "[cmake] Explicitly disable download step"

This does not help. The build is broken because compiler-rt-clear
deletes cmake generated files in STAMP_DIR/

This reverts commit da89ed99a16920e5986b14853d297322ccf7109e.

16 months ago[mlir][openacc] Refine data operation data clause attribute
Razvan Lupusoru [Wed, 19 Apr 2023 17:59:41 +0000 (10:59 -0700)]
[mlir][openacc] Refine data operation data clause attribute

The data operations added in D148389 hold two data clause fields:
"dataClause" and "decomposedFrom". However, in most cases, dataClause
field holds a default value (except for acc_copyin_readonly,
acc_create_zero, and acc_copyout_zero).

The decomposedFrom field holds the original clause specified by user.
As work began on lowering to these new operations [1], it seems that
having both fields adds a bit of ambiguity. There is only one scenario
where we actually intended to use both:
acc data copyout(zero:)

The original intent was that this clause would be decomposed to
the following operations:
acc.create {dataClause = acc_create_zero, decomposedFrom =
acc_copyout_zero}
...
acc.copyout {dataClause = acc_copyout_zero}

However, we can encode the zero semantics like so without need of both:
acc.create {dataClause = acc_copyout_zero}
...
acc.copyout {dataClause = acc_copyout_zero}

Thus get rid of the decomposedFrom field and update verifier checks
to check for all data clauses that can be decomposed to the particular
operation.

So now the dataClause holds the original user's clause which simplifies
understanding of the operation.

[1] https://reviews.llvm.org/D148721

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D148731

16 months ago[lldb] Change setting descriptions to use StringRef instead of ConstString
Alex Langford [Wed, 19 Apr 2023 01:45:03 +0000 (18:45 -0700)]
[lldb] Change setting descriptions to use StringRef instead of ConstString

These probably do not need to be in the ConstString StringPool as they
don't really need any of the advantages that ConstStrings offer.
Lifetime for these things is always static and we never need to perform
comparisons for setting descriptions.

Differential Revision: https://reviews.llvm.org/D148679

16 months ago[compiler-rt] [test] [profile] Avoid issues with an implicit .exe suffix
Martin Storsjö [Wed, 12 Apr 2023 11:17:48 +0000 (11:17 +0000)]
[compiler-rt] [test] [profile] Avoid issues with an implicit .exe suffix

Mingw toolchains implicitly add an .exe suffix if the output linked
file doesn't have a suffix. In many cases the extra suffix doesn't
cause any issues, but in some tests, this discrepancy between expected
output file name and actual output file does affect the tests.

In one test, a rm command fails to remove the executable since it
doesn't have the expected name. By failing to remove the executable, the
later llvm-profdata command tries to read the executable as if it was
a profile data file.

In another test, when the Python executor executes commands, it can
resolve executable names without the extra .exe suffix for absolute
paths (when most binaries are executed as e.g. "%t/foo"), but it fails
to resolve the executables for relative paths such as "./foo". Making
the paths absolute by using %t here shouldn't affect what the test tries
to validate.

Differential Revision: https://reviews.llvm.org/D148169

16 months ago[SLP][NFC] Test showing a cost estimation issue caused by f82eb7e066f322a231627383fc8...
Vasileios Porpodas [Wed, 19 Apr 2023 00:47:18 +0000 (17:47 -0700)]
[SLP][NFC] Test showing a cost estimation issue caused by f82eb7e066f322a231627383fc80522d98ce6181

The buildvector cost for the case shown in the test should be 0 but it is -1, causing the code to get vectorized, whenit shouldn't.

Differential Revision: https://reviews.llvm.org/D148732

16 months ago[libc++] Remove symbols for a std::allocator_arg & friends from the dylib
Louis Dionne [Mon, 6 Mar 2023 21:14:06 +0000 (16:14 -0500)]
[libc++] Remove symbols for a std::allocator_arg & friends from the dylib

This patch removes the symbols defined in the library for std::allocator_arg,
std::defer_lock, std::try_to_lock, std::adopt_lock, and std::piecewise_construct.
Those were defined in the library because we provided them in C++03 as an
extension, and in C++03 it was impossible to define them as `constexpr`
variables, like in the spec.

This is technically an ABI break since we are removing symbols from the
library. However, in practice, only programs compiled in C++03 mode who
take the address of those objects (or pass them as a reference) will have
an undefined ref to those symbols. In practice, this is expected to be
rare. First, those are C++11 features that we happen to provide in C++03,
and only the C++03 definition can potentially lead to code referencing
the dylib definition. So any code that is using these objects but compiling
in C++11 mode (as they should) is not at risk. Second, all uses of these
types in the library is done by passing those types by value to a function
that can get inlined. Since they are empty types, the compiler won't
generate an undefined reference if passed by value, since there's nothing
to pass anyway.

Long story short, the risk for code actually containing an undefined
reference to one of these types is rather small (but non-zero). I also
couldn't find any app on the App Store that referenced these symbols,
which supports my impression that this won't be an issue in practice.

Differential Revision: https://reviews.llvm.org/D145587

16 months ago[lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf
Alex Langford [Tue, 18 Apr 2023 23:46:12 +0000 (16:46 -0700)]
[lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf

Instead of creating a std::string from the `SmallString`,
let's just use a std::string from the start. I initially tried to make
`SmallString` work but getting it right proved complicated because
`LogHandler::Emit` will take its `StringRef` parameter and touch the raw
`const char *` from it directly, which isn't guaranteed to be
null-terminated with a `SmallString`.

I changed `WriteMessage` to take a `StringRef` instead of a
`const std::string &` for flexibility.

Differential Revision: https://reviews.llvm.org/D148676

16 months ago[MemProf] Fix bot failure about missing return value along all paths
Teresa Johnson [Wed, 19 Apr 2023 21:05:26 +0000 (14:05 -0700)]
[MemProf] Fix bot failure about missing return value along all paths

Fixes warning treated as error from
https://lab.llvm.org/buildbot/#/builders/13/builds/34440:
  'llvm::LibCallSimplifier::optimizeNew': not all control paths return a value
after a35206d78280e0ebcf48cd21bc5fff5c3b9c73fa.

Change assert in default case to a return nullptr, so we have a
reasonable fallback if invoked on a different library function, and no
longer get the above warning.

16 months ago[DebugInfo] printCompactDWARFExpr: don't assert on stack size
Scott Linder [Wed, 8 Feb 2023 20:01:42 +0000 (20:01 +0000)]
[DebugInfo] printCompactDWARFExpr: don't assert on stack size

Gracefully handle non-1 stack sizes in printCompactDWARFExpr rather than
assert. Add support for DW_OP_nop and test the zero-sized stack case.

This is intended to be nearly NFC.

Differential Revision: https://reviews.llvm.org/D147269

16 months ago[HeterogeneousDWARF] Update encodings in AMDGPUDwarfExtensionsForHeterogeneousDebuggi...
Scott Linder [Thu, 23 Feb 2023 19:53:47 +0000 (19:53 +0000)]
[HeterogeneousDWARF] Update encodings in AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst

Repurpose the DW_OP_LLVM_aspace_implicit_pointer encoding (0xe9) as the
encoding for a new operation DW_OP_LLVM_user which prefixes all other
new operations.

Differential Revision: https://reviews.llvm.org/D147265

16 months ago[MemProf] Optionally pass hot/cold hints to operator new
Teresa Johnson [Wed, 19 Apr 2023 15:21:52 +0000 (08:21 -0700)]
[MemProf] Optionally pass hot/cold hints to operator new

Optionally (off by default) replace operator new() calls marked with a
hot or cold memprof attribute with an operator new() call that takes a
hot_cold_t parameter.

Currently this is supported by the open source version of tcmalloc, see:
https://github.com/google/tcmalloc/blob/master/tcmalloc/new_extension.h

Differential Revision: https://reviews.llvm.org/D148718

16 months ago[libc] Fix `nvptx_options` variable not being reset in CMake
Joseph Huber [Wed, 19 Apr 2023 20:27:33 +0000 (15:27 -0500)]
[libc] Fix `nvptx_options` variable not being reset in CMake

Summary:
This variable was not being reset, which caused the options to be
compounded when building multiple architectures. This was very
problematic as the architectures are not compatible.

16 months ago[libc++abi] Make the error message for recursive initialization of function-local...
Louis Dionne [Tue, 18 Apr 2023 12:46:49 +0000 (12:46 +0000)]
[libc++abi] Make the error message for recursive initialization of function-local statics more explicit

The new message is a bit verbose, but it makes it clearer that this isn't
a problem in libc++abi, but instead a problem in the user's code. Otherwise,
we get bugs sent down to libc++abi because people see this message in their
crash logs.

Differential Revision: https://reviews.llvm.org/D148630

16 months ago[Driver] Make -fsanitize=kcfi,function incompatible
Fangrui Song [Wed, 19 Apr 2023 20:15:33 +0000 (13:15 -0700)]
[Driver] Make -fsanitize=kcfi,function incompatible

A -fsanitize=kcfi instrumented function has a special instruction/data
before the function entry at a fixed offset.
A -fsanitize=function instrumented function has special instruction/data
after the function entry at a fixed offset (may change to *before* in D148665).

The two instrumentations are not intended to be used together and will become
incompatible after D148665.

Reviewed By: samitolvanen

Differential Revision: https://reviews.llvm.org/D148671

16 months ago[Driver] -fsanitize=kcfi doesn't need RequiresPIE
Fangrui Song [Wed, 19 Apr 2023 20:10:46 +0000 (13:10 -0700)]
[Driver] -fsanitize=kcfi doesn't need RequiresPIE

As mentioned on D148671: this is unneeded. This commit is a no-op for most Linux
builds since CLANG_DEFAULT_PIE_ON_LINUX defaults to 1.

16 months ago[libunwind] [SEH] Add debug logging in __libunwind_seh_personality
Martin Storsjö [Tue, 18 Apr 2023 12:04:57 +0000 (15:04 +0300)]
[libunwind] [SEH] Add debug logging in __libunwind_seh_personality

Differential Revision: https://reviews.llvm.org/D148659

16 months ago[compiler-rt] [test] [ubsan] Mark failing tests as unsupported for mingw configs
Martin Storsjö [Wed, 12 Apr 2023 09:12:28 +0000 (09:12 +0000)]
[compiler-rt] [test] [ubsan] Mark failing tests as unsupported for mingw configs

All of these are already unsupported for MSVC style configs. For
some cases, simplify the regex to match any windows triple, while
for others, mention windows-msvc and windows-gnu specifically,
if they are separate cases that happen to fail for different reasons.

-fsanitize=function is unsupported both in mingw and MSVC modes.

The vptr tests expect to get demangled C++ type info names, but
Itanium C++ typenames don't get demangled by ubsan on Windows.

The test that tries to build a .so doesn't work as such on
Windows.

While mingw toolchains do support weak symbols, the relevant
sanitizer symbols aren't made weak on Windows.

Differential Revision: https://reviews.llvm.org/D148163

16 months ago[OpenMP] Prefix outlined and reduction func names with original func's name
Itay Bookstein [Fri, 23 Dec 2022 09:35:47 +0000 (11:35 +0200)]
[OpenMP] Prefix outlined and reduction func names with original func's name

This patch prefixes omp outlined helpers and reduction funcs
with the original function's name.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D140722

16 months agoworkflows/release-binaries: Add missing output variable
Tom Stellard [Wed, 19 Apr 2023 19:58:59 +0000 (12:58 -0700)]
workflows/release-binaries: Add missing output variable

Reviewed By: thieta

Differential Revision: https://reviews.llvm.org/D148734

16 months ago[cmake] Explicitly disable download step
Vitaly Buka [Wed, 19 Apr 2023 19:51:00 +0000 (12:51 -0700)]
[cmake] Explicitly disable download step

Fixes the following on cmake version 3.24.2:
'tools/clang/runtime/compiler-rt-stamps/compiler-rt-source_dirinfo.txt',
needed by 'tools/clang/runtime/compiler-rt-stamps/compiler-rt-download',
missing and no known rule to make it

Maybe related to https://cmake.org/cmake/help/latest/release/3.24.html#modules

16 months ago[BOLT][NFC] Move phdr typedef to cpp file
Nathan Sidwell [Tue, 18 Apr 2023 22:14:21 +0000 (18:14 -0400)]
[BOLT][NFC] Move phdr typedef to cpp file

This typedef is only used inside the RewriteInstance source file, let's not
expose it in the header file -- even if private.

Differential Revision: https://reviews.llvm.org/D148667

16 months ago[BOLT] Adjust Shdr alignment
Nathan Sidwell [Tue, 18 Apr 2023 22:13:16 +0000 (18:13 -0400)]
[BOLT] Adjust Shdr alignment

Shdr's are not necesarily size 2^n, and there is no reason to align to
that boundary if they are.

Differential Revision: https://reviews.llvm.org/D148666

16 months ago[libc++] Add helper script libcxx-lit for running tests
Louis Dionne [Tue, 18 Apr 2023 13:25:16 +0000 (13:25 +0000)]
[libc++] Add helper script libcxx-lit for running tests

Differential Revision: https://reviews.llvm.org/D148632

16 months ago[InferAttrs] Mark frexp and modf as memory(argmem: write)
Daniel Woodworth [Wed, 19 Apr 2023 19:23:57 +0000 (15:23 -0400)]
[InferAttrs] Mark frexp and modf as memory(argmem: write)

These two math library functions can't write to errno, but they do
produce two results and store the second result to a pointer passed as
their second argument. Appropriately marking them as
memory(argmem: write) enables more optimizations on calls to them.

Reviewed By: xbolva00

Differential Revision: https://reviews.llvm.org/D148043

16 months ago[CMake] Switch back to -fPIC for Fuchsia Toolchain
Daniel Thornburgh [Mon, 17 Apr 2023 22:54:11 +0000 (15:54 -0700)]
[CMake] Switch back to -fPIC for Fuchsia Toolchain

This reverts commit 1fab236e6e4575d5af4f4722216df4dd6a872795.

Shipping LLDB means distributing libLLDB.so, which will need to be built
with PIC. Disabling PIC also removes the libLTO target, which is a hard
dependency of the LLDB test suite.

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D148577

16 months ago[MLIR][LLVM] Realign allocas to avoid dynamic realignment in inliner.
Johannes de Fine Licht [Tue, 18 Apr 2023 15:17:13 +0000 (15:17 +0000)]
[MLIR][LLVM] Realign allocas to avoid dynamic realignment in inliner.

When the natural stack alignment is not set or is larger than or equal
to the target alignment required by a read-only byval argument defined
by an alloca, avoid the copy by just realigning the alloca to the target
alignment.

The code to check existing alignment is reorganized a bit to avoid
redundant casts.

This also includes a bugfix for passing a null DataLayoutInterface to
the DataLayout constructor when no parent op defines
DataLayoutInterface, and will now pass ModuleOp instead in this case.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D148557

16 months ago[pseudo] Use shared copy of bundle_resources.py
Sam McCall [Wed, 19 Apr 2023 18:38:15 +0000 (20:38 +0200)]
[pseudo] Use shared copy of bundle_resources.py

16 months agoRevert D146987 "[Assignment Tracking] Enable by default"
OCHyams [Wed, 19 Apr 2023 18:16:40 +0000 (19:16 +0100)]
Revert D146987 "[Assignment Tracking] Enable by default"

This reverts commit 89d27854ec7f5e8bd83e72fa574740bf3d06355b.

See https://reviews.llvm.org/D146987 for issues.

16 months ago[gn build] Port a443b3d18ef4 (HTMLLogger.inc)
Nico Weber [Wed, 19 Apr 2023 17:52:40 +0000 (13:52 -0400)]
[gn build] Port a443b3d18ef4 (HTMLLogger.inc)

Similar to 374db8fc2e49f.

16 months ago[mlir] Allow to specify target type in `convertType`
Jakub Kuderski [Wed, 19 Apr 2023 17:51:13 +0000 (13:51 -0400)]
[mlir] Allow to specify target type in `convertType`

Add a new helper function for the type converter that takes care of
casting to the target type.

This is to avoid bugs where an incorrect cast function is used after
type conversion, e.g., `dyn_cast` or `cast`. These are not guaranteed to
work when type conversion fails, or when type conversion succeeds but
the provided type converted returned a type that a conversion pattern
did not expect.

I saw this being an issue in some SPIR-V passes and in mlir-hlo.

Exercise the new function in a couple of passes. As a side-effect, this
also made the code more concise.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D148725

16 months agoRevert "[lldb] Fix bug to update process public run lock with process state"
Med Ismail Bennani [Wed, 19 Apr 2023 17:46:17 +0000 (10:46 -0700)]
Revert "[lldb] Fix bug to update process public run lock with process state"

This reverts commit 14f00213b202a82b895a6ab749262d4382435012.

16 months ago[mlir][openacc] Keep region when applying data operand conversion
Valentin Clement [Wed, 19 Apr 2023 17:27:15 +0000 (10:27 -0700)]
[mlir][openacc] Keep region when applying data operand conversion

Keep the region when the operation has one. The previous code
was throwing away the region when creating the new version
of the operation.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148039

16 months ago[clang] makes `__is_trivially_equality_comparable` available as a struct
Christopher Di Bella [Wed, 19 Apr 2023 00:58:43 +0000 (00:58 +0000)]
[clang] makes `__is_trivially_equality_comparable` available as a struct

Since this was originally a name in library, it needs an escape hatch
for versions of Clang that are slightly out-of-sync with libc++.

Differential Revision: https://reviews.llvm.org/D148677

16 months ago[docs] Remove a duplicate or unnecessary 'to' in a sentence.
Hiroshi Yamauchi [Tue, 18 Apr 2023 20:05:52 +0000 (13:05 -0700)]
[docs] Remove a duplicate or unnecessary 'to' in a sentence.

Differential Revision: https://reviews.llvm.org/D148657

16 months ago[lldb] Fix bug to update process public run lock with process state
Med Ismail Bennani [Wed, 19 Apr 2023 06:35:45 +0000 (23:35 -0700)]
[lldb] Fix bug to update process public run lock with process state

This patch should address an issue that caused the process public run
lock to not be updated during a process launch/attach when the process
stops.

That caused the public run lock to report its state as running while the
process state is stopped. This prevents the users to interact with the
process (through the command line or via the SBAPI) since it's
considered still running.

To address that, this patch refactors the name of the internal hijack
listeners to a specific pattern `lldb.internal.<action>.hijack` that
are used to ensure that we've attached to or launched a process successfully.

Then, when updating the process public state, after updating the state
value, if the process is not hijacked externally, meaning if the process
doens't have a hijack listener that matches the internal hijack
listeners pattern, we can update the public run lock accordingly.

Differential Revision: https://reviews.llvm.org/D148400

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
16 months ago[Header][doc] Tweak wording for MWAIT[X] intrinsics
Paul Robinson [Wed, 19 Apr 2023 16:57:17 +0000 (09:57 -0700)]
[Header][doc] Tweak wording for MWAIT[X] intrinsics

16 months agoRevert "[OpenMP] Prefix outlined and reduction func names with original func's name"
Itay Bookstein [Wed, 19 Apr 2023 16:08:11 +0000 (19:08 +0300)]
Revert "[OpenMP] Prefix outlined and reduction func names with original func's name"

This reverts commit 029bfc311d4d7d3cd90be81bb08c046848796d02.

16 months ago[Headers][doc] Add/revise MONITOR/MWAIT descriptions
Paul Robinson [Tue, 18 Apr 2023 19:37:49 +0000 (12:37 -0700)]
[Headers][doc] Add/revise MONITOR/MWAIT descriptions

Differential Revision: https://reviews.llvm.org/D148653

16 months ago[flang] Semantics for !DIR$ IGNORE_TKR
Peter Klausler [Mon, 10 Apr 2023 18:05:03 +0000 (11:05 -0700)]
[flang] Semantics for !DIR$ IGNORE_TKR

Implement semantics for the IGNORE_TKR directive as it is interpreted
by the PGI / NVFORTRAN compiler.

Differential Revision: https://reviews.llvm.org/D148643

16 months ago[OpenMP] Prefix outlined and reduction func names with original func's name
Itay Bookstein [Fri, 23 Dec 2022 09:35:47 +0000 (11:35 +0200)]
[OpenMP] Prefix outlined and reduction func names with original func's name

This patch attempts to prefix omp outlined helpers and reduction funcs
with the original function's name.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D140722

16 months ago[compiler-rt] [test] [profile] Generalize existing MSVC XFAILs to cover mingw too
Martin Storsjö [Wed, 12 Apr 2023 11:45:41 +0000 (11:45 +0000)]
[compiler-rt] [test] [profile] Generalize existing MSVC XFAILs to cover mingw too

Differential Revision: https://reviews.llvm.org/D148167

16 months ago[compiler-rt] [test] Don't override config.unsupported in TestCases/Windows
Martin Storsjö [Fri, 14 Apr 2023 20:58:34 +0000 (20:58 +0000)]
[compiler-rt] [test] Don't override config.unsupported in TestCases/Windows

This is a leftover from when these tests were added in
2bdca2006941a3a7de8e16ea9af9a758b367ee32 in 2014 (when the toplevel
asan/lit.cfg set "config.unsupported = True" on Windows). When the
common tests were included on Windows in
89d994367a597134fa7e1724314044e217718165 in 2015, that commit should
have removed the now unnecessary "config.unsupported = False" line here.

Differential Revision: https://reviews.llvm.org/D148442

16 months ago[libcxx] [ci] Run the libcxxabi and libunwind tests in mingw configurations
Martin Storsjö [Wed, 5 Apr 2023 12:25:09 +0000 (15:25 +0300)]
[libcxx] [ci] Run the libcxxabi and libunwind tests in mingw configurations

The check-runtimes function runs check-cxx, check-cxxabi and check-unwind.

Differential Revision: https://reviews.llvm.org/D148267

16 months ago[TTI][BPF] Ensure ArgumentPromotion Not Exceeding Target MaxArgs
Yonghong Song [Mon, 17 Apr 2023 18:11:59 +0000 (11:11 -0700)]
[TTI][BPF] Ensure ArgumentPromotion Not Exceeding Target MaxArgs

With LLVM patch https://reviews.llvm.org/D148269, we hit a linux kernel
bpf selftest compilation failure like below:
  ...
  progs/test_xdp_noinline.c:739:8: error: too many args to t8: i64 = GlobalAddress<ptr @encap_v4> 0, progs/test_xdp_noinline.c:739:8
              if (!encap_v4(xdp, cval, &pckt, dst, pkt_bytes))
                   ^
  ...
  progs/test_xdp_noinline.c:321:6: error: defined with too many args
  bool encap_v4(struct xdp_md *xdp, struct ctl_value *cval,
       ^
  ...

Note that bpf selftests are compiled with -O2 which is
the recommended flag for bpf community.

The bpf backend calling convention is only allowing 5
parameters in registers and does not allow pass arguments
through stacks. In the above case, ArgumentPromotionPass
replaced parameter '&pckt' as two parameters, so the total
number of arguments after ArgumentPromotion pass becomes 6
and this caused later compilation failure during instruction
selection phase.

This patch added a TargetTransformInfo hook getMaxNumArgs()
which returns 5 for BPF and UINT_MAX for other targets.

Differential Revision: https://reviews.llvm.org/D148551

16 months ago[NFC][AArch64] Add cost model tests for extending loads
David Sherwood [Tue, 11 Apr 2023 12:10:33 +0000 (12:10 +0000)]
[NFC][AArch64] Add cost model tests for extending loads

Differential Revision: https://reviews.llvm.org/D148122

16 months ago[libc++] Adds missing includes.
Mark de Wever [Tue, 18 Apr 2023 17:19:48 +0000 (19:19 +0200)]
[libc++] Adds missing includes.

This patch makes are code less dependant on transitive includes.

This was part of D145800. This patch will be abandoned, but these
changes are still useful. I manually verified declarations of the new
includes are used in these files.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D148645

16 months ago[AMDGPU] NFC. Refactor GISel for cmp intrinsics
Joe Nash [Mon, 17 Apr 2023 21:22:43 +0000 (17:22 -0400)]
[AMDGPU] NFC. Refactor GISel for cmp intrinsics

Combine the logic for fcmp and icmp intrinsics and use operand presence
instead.

Reviewed By: kosarev, foad

Differential Revision: https://reviews.llvm.org/D148716

16 months ago[AMDGPU] Fix some check prefixes
Jay Foad [Wed, 19 Apr 2023 14:26:32 +0000 (15:26 +0100)]
[AMDGPU] Fix some check prefixes

16 months ago[AMDGPU] Remove unused check lines from tests
Jay Foad [Wed, 19 Apr 2023 14:23:55 +0000 (15:23 +0100)]
[AMDGPU] Remove unused check lines from tests

16 months ago[MLIR] Fix missing ::mlir namespace
Arash Taheri-Dezfouli [Wed, 19 Apr 2023 15:09:29 +0000 (15:09 +0000)]
[MLIR] Fix missing ::mlir namespace

Add a missing ::mlir namespace for MixedContainerType
that only triggers if the user is not using namespace mlir.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D147956

16 months ago[dwarfdump][AMDGPU] Support EF_AMDGPU_MACH_NONE
Scott Linder [Wed, 19 Apr 2023 15:02:08 +0000 (15:02 +0000)]
[dwarfdump][AMDGPU] Support EF_AMDGPU_MACH_NONE

A quirk of the AMDGPU backend is EF_AMDGPU_MACH_NONE, which is not
specific to the r600 or amdgcn architecture, but can be combined with
either.

AMDGPU ELF code objects with this mach value cannot be mapped back to a
Triple architecture, as it could be either r600 or amdgcn. For
llvm-dwarfdump this means the normal method of inspecting
ObjectFile::getArch to determine how to handle relocations is
insufficient.

This patch adds an extra check for ELF code objects which would
otherwise be categorized as UnknownArch, making it possible to use
llvm-dwarfdump with them. For completeness it also adds support for
known r600 machines.

This also adds specific tests for llvm-dwarfdump for amdgcn and r600,
both with known and unknown mach values.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D144301

16 months ago[flang][openacc] Add OpenACC pointer interface to FIR pointer types
Razvan Lupusoru [Tue, 18 Apr 2023 22:42:16 +0000 (15:42 -0700)]
[flang][openacc] Add OpenACC pointer interface to FIR pointer types

The OpenACC dialect data clauses require for variables appearing in data
operations to implement the `PointerLikeType` interface (similarly to
OpenMP dialect). Thus, this interface needs attached to FIR types.

Two of the FIR types, HeapType and LLVMPointerType, did not provide
getElementType - now they do by calling getEleTy. This cleans up the
interface attachment for both OpenACC and OpenMP dialects.

Reviewed By: clementval, jeanPerier

Differential Revision: https://reviews.llvm.org/D148560

16 months ago[AArch64][CodeGen] Allow vectors larger than hardware support to use SVE's load zero...
Dinar Temirbulatov [Wed, 19 Apr 2023 14:17:32 +0000 (14:17 +0000)]
[AArch64][CodeGen] Allow vectors larger than hardware support to use SVE's load zero/sign-extend for fixed vectors.

Prefer to fold LOAD + SIGN/ZEROEXTEND to SVE load and sign extend instructions
for fixed-length-vectors even if a type is not representable on a hardware.

Differential Revision: https://reviews.llvm.org/D147533

16 months agoRemove unused ValueTracking.h include from DebugInfo.cpp
OCHyams [Wed, 19 Apr 2023 14:14:18 +0000 (15:14 +0100)]
Remove unused ValueTracking.h include from DebugInfo.cpp

Buildbot: https://buildkite.com/llvm-project/upstream-bazel/builds/
                        59967#01879985-8d44-4041-9cd0-a1e41371208e

See https://reviews.llvm.org/D148536

16 months ago[AMDGPU] Remove unused check lines from GlobalISel IR tests
Jay Foad [Wed, 19 Apr 2023 14:12:50 +0000 (15:12 +0100)]
[AMDGPU] Remove unused check lines from GlobalISel IR tests

16 months ago[dataflow] add missing clangLex dep after a443b3d18ef4d01e7
Sam McCall [Wed, 19 Apr 2023 14:11:58 +0000 (16:11 +0200)]
[dataflow] add missing clangLex dep after a443b3d18ef4d01e7

16 months ago[SCF] Clean up ForOpTensorCastFolder and harden it against nop tensor casts
Benjamin Kramer [Wed, 19 Apr 2023 13:31:34 +0000 (15:31 +0200)]
[SCF] Clean up ForOpTensorCastFolder and harden it against nop tensor casts

The code was inserting a new cast, discarding it, then inserting it
again.

The self-cast issue is the root of #62135 because it would end up
dropping the loop and inserting an invalid cast to itself. As far as I
can tell tensor.cast with the same src and dst types is not invalid but
it can't really be tested in isolation as it's immediately folded.

Fixes #62135

Differential Revision: https://reviews.llvm.org/D148714

16 months ago[AMDGPU] Remove unused check lines from GlobalISel MIR tests
Jay Foad [Wed, 19 Apr 2023 13:54:50 +0000 (14:54 +0100)]
[AMDGPU] Remove unused check lines from GlobalISel MIR tests

16 months ago[dataflow] add HTML logger: browse code/cfg/analysis timeline/state
Sam McCall [Wed, 8 Mar 2023 15:13:28 +0000 (16:13 +0100)]
[dataflow] add HTML logger: browse code/cfg/analysis timeline/state

With -dataflow-log=/dir we will write /dir/0.html etc for each
function analyzed.

These files show the function's code and CFG, and the path through
the CFG taken by the analysis. At each analysis point we can see the
lattice state.

Currently the lattice state dump is not terribly useful but we can
improve this: showing values associated with the current Expr,
simplifying flow condition, highlighting changes etc.

(Trying not to let this patch scope-creep too much, so I ripped out the
half-finished features)

Demo: https://htmlpreview.github.io/?https://gist.githubusercontent.com/sam-mccall/1746985bf13406bd19181af281aea9ff/raw/9718fdd48406dabccb3092acd983b4bd55da9dfa/analysis.html

Differential Revision: https://reviews.llvm.org/D146591

16 months ago[OpenMP][MLIR] Add lowering of omp::FlagsAttr to LLVM-IR
Andrew Gozillon [Wed, 19 Apr 2023 13:21:24 +0000 (08:21 -0500)]
[OpenMP][MLIR] Add lowering of omp::FlagsAttr to LLVM-IR

The omp::FlagsAttr contains OpenMP RTL flags
given by a user to the compiler and a frontend
(flang currently) then populates the omp::FlagsAttr
which will then lower these to LLVM globals
which are utilised by the OpenMP runtime.

Reviewers: jdoerfert

Differential Revision: https://reviews.llvm.org/D147344

16 months ago[AArch64] Remove dead tryMLAV64LaneV128 and tryMULLV64LaneV128 code.
David Green [Wed, 19 Apr 2023 13:26:27 +0000 (14:26 +0100)]
[AArch64] Remove dead tryMLAV64LaneV128 and tryMULLV64LaneV128 code.

As far as I can tell this code is never used, as the pattern recognised by
checkHighLaneIndex (an duplane with insert_subvec and extract_subvec) will not
be generated any more. There are no tests that change from removing it
(including the clang neon tests), and it didn't appear to come up in any
benchmarks I ran. There are already existing tablegen patterns for MLA with
index and s/umull with index.

Removing it also prevents it from causing problems for SVE, as in #62151.

Differential Revision: https://reviews.llvm.org/D148646

16 months ago[DAGCombine][AArch64] Allow transformable to legal vectors to be used for MULH lowering.
Dinar Temirbulatov [Wed, 19 Apr 2023 13:24:58 +0000 (13:24 +0000)]
[DAGCombine][AArch64] Allow transformable to legal vectors to be used for MULH lowering.

It looks like it is still profitable to accept a transformable to a legal vector
type, not just a legal vector, as long as vector elements are the same between
two of those types.

Differential Revision: https://reviews.llvm.org/D148229

16 months agoReapply D146987 "[Assignment Tracking] Enable by default"
OCHyams [Wed, 19 Apr 2023 12:59:08 +0000 (13:59 +0100)]
Reapply D146987 "[Assignment Tracking] Enable by default"

This reverts commit 7674ae7231c4e286b93eb399e475765630666f8b which
reverts D146987.

See https://reviews.llvm.org/D146987 for issues.

16 months ago[libc] Add the '--threads' and '--blocks' option to the GPU loaders
Joseph Huber [Mon, 17 Apr 2023 20:08:59 +0000 (15:08 -0500)]
[libc] Add the '--threads' and '--blocks' option to the GPU loaders

We will want to test the GPU `libc` with multiple threads in the future.
This patch adds the `--threads` and `--blocks` option to set the `x`
dimension of the kernel. Using CUDA terminology instead of OpenCL for
familiarity.

Depends on D148288 D148342

Reviewed By: jdoerfert, sivachandra, tra

Differential Revision: https://reviews.llvm.org/D148485

16 months ago[libc] Add a support library for GPU utilities
Joseph Huber [Tue, 18 Apr 2023 14:44:27 +0000 (09:44 -0500)]
[libc] Add a support library for GPU utilities

The GPU has many features that can only be accessed through builtin or
intrinsic functions. Furthermore, these functions are unique for each
GPU target. This patch outlines an interface to create a common `libc`
interface to access these. Currently I only implement a function for the
CUDA equivalent of `blockIdx.x`. More will be added in the future.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D148635

16 months ago[SLP]Fix cost estimation for buildvectors with extracts and/or constants.
Alexey Bataev [Fri, 14 Apr 2023 16:35:03 +0000 (09:35 -0700)]
[SLP]Fix cost estimation for buildvectors with extracts and/or constants.

If the partial matching is found and some other scalars must be
inserted, need to account the cost of the extractelements, transformed
to shuffles, and/or reused entries and calculate the cost of inserting
constants properly into the non-poison vectors.
Also, fixed the cost calculation for final gather/buildvector sequence.

Differential Revision: https://reviews.llvm.org/D148362

16 months ago[SanitizerBinaryMetadata] Respect no_sanitize("thread") function attribute
Marco Elver [Wed, 19 Apr 2023 12:46:42 +0000 (14:46 +0200)]
[SanitizerBinaryMetadata] Respect no_sanitize("thread") function attribute

To avoid false positives, respect no_sanitize("thread") when atomics
metadata is enabled.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D148694

16 months ago[gn build] Port bf47c1ed8556
LLVM GN Syncbot [Wed, 19 Apr 2023 12:38:32 +0000 (12:38 +0000)]
[gn build] Port bf47c1ed8556

16 months agoReapply "[Assignment Tracking] Fix fragment error for some DSE-shortened stores"
OCHyams [Wed, 19 Apr 2023 12:11:22 +0000 (13:11 +0100)]
Reapply "[Assignment Tracking] Fix fragment error for some DSE-shortened stores"

This reverts commit 6db6ab4815a44bfcaabfcdd84a0ff458394f6f52 which reverts
D148536.

Build issues addressed in D148698.