platform/upstream/llvm.git
16 months ago[libc] Fix hanging test on NVPTX due to lack of warp sync
Joseph Huber [Fri, 5 May 2023 02:36:52 +0000 (21:36 -0500)]
[libc] Fix hanging test on NVPTX due to lack of warp sync

Previously this wasn't implemented because it's effectively a no-op.
However, this should be safe to emit on sm_60 architectures. It's
important because it carries semantic importance for whether or not
something can be moved. So we should always emit this instrinsic.

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

16 months ago[Coverity] Big parameter passed by value.
Luo, Yuanke [Fri, 5 May 2023 01:50:19 +0000 (09:50 +0800)]
[Coverity] Big parameter passed by value.

16 months ago[SeparateConstOffsetFromGEP] Fix bug handling negative offsets
Tom Stellard [Fri, 5 May 2023 01:45:48 +0000 (18:45 -0700)]
[SeparateConstOffsetFromGEP] Fix bug handling negative offsets

Fix bug constants and sub instructions

When finding constants in a chain starting with the RHS operator of
sub instructions, we were negating the constant before zero extending
it, which is incorrect.

Unfortunately, I was unable to find a simple way to implement this
transformation correctly, so for now I just disabled this optimization
for constants that feed into the RHS of a sub.

Resolves #62379

Transformation from alive2.llvm.org:

    define i16 @src(i8 %a, i8 %b, i8 %c) {
    entry:
    %0 = sub nuw nsw i8 %c, %a
    %1 = sub nuw nsw i8 %b, %0
    %2 = zext i8 %1 to i16
    ret i16 %2
    }

    Before/Bad:

    define i16 @tgt(i8 %a, i8 %b, i8 %c) {
    entry:
    %0 = zext i8 %a to i16
    %1 = zext i8 %b to i16
    %c_neg = sub i8 0, %c
    %c_zext = zext i8 %c_neg to i16
    %2 = sub i16 0, %0
    %3 = sub i16 %1, %2
    %4 = add i16 %3, %c_zext
    ret i16 %4
    }

    Correct:

    define i16 @tgt(i8 %a, i8 %b, i8 %c) {
    entry:
    %0 = zext i8 %a to i16
    %1 = zext i8 %b to i16
    %c_zext = zext i8 %c to i16
    %c_neg = sub i16 0, %c_zext
    %2 = sub i16 0, %0
    %3 = sub i16 %1, %2
    %4 = add i16 %3, %c_neg
    ret i16 %4
    }

Reviewed By: nikic

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

16 months ago[Coverity] Big parameter passed by value.
Luo, Yuanke [Fri, 5 May 2023 01:14:04 +0000 (09:14 +0800)]
[Coverity] Big parameter passed by value.

16 months ago[RISCV] Restrict valid indices for cm.jalt to be in [32,255].
Craig Topper [Fri, 5 May 2023 00:48:30 +0000 (17:48 -0700)]
[RISCV] Restrict valid indices for cm.jalt to be in [32,255].

Reviewed By: jrtc27

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

16 months ago[ASan][libcxx] Annotating std::vector with all allocators
Advenam Tacet [Fri, 5 May 2023 00:43:51 +0000 (17:43 -0700)]
[ASan][libcxx] Annotating std::vector with all allocators

This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).

The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.

In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.

Additionally, this revision fixes unpoisoning in std::vector.
It guarantees that __alloc_traits::deallocate may access returned memory.
Originally suggested in D144155 revision.

If you have any questions, please email:
 - advenam.tacet@trailofbits.com
 - disconnect3d@trailofbits.com

Reviewed By: #libc, #sanitizers, philnik, vitalybuka, ldionne

Spies: mikhail.ramalho, manojgupta, ldionne, AntonBikineev, ayzhao, hans, EricWF, philnik, #sanitizers, libcxx-commits

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

16 months ago[libc] Change GPU startup and loader to use multiple kernels
Joseph Huber [Mon, 1 May 2023 13:17:39 +0000 (08:17 -0500)]
[libc] Change GPU startup and loader to use multiple kernels

The GPU has a different execution model to standard `_start`
implementations. On the GPU, all threads are active at the start of a
kernel. In order to correctly intitialize and call the constructors we
want single threaded semantics. Previously, this was done using a
makeshift global barrier with atomics. However, it should be easier to
simply put the portions of the code that must be single threaded in
separate kernels and then call those with only one thread. Generally,
mixing global state between kernel launches makes optimizations more
difficult, similarly to calling a function outside of the TU, but for
testing it is better to be correct.

Depends on D149527 D148943

Reviewed By: JonChesterfield

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

16 months ago[libc] Enable multiple threads to use RPC on the GPU
Joseph Huber [Thu, 4 May 2023 19:53:28 +0000 (14:53 -0500)]
[libc] Enable multiple threads to use RPC on the GPU

The execution model of the GPU expects that groups of threads will
execute in lock-step in SIMD fashion. It's both important for
performance and correctness that we treat this as the smallest possible
granularity for an RPC operation. Thus, we map multiple threads to a
single larger buffer and ship that across the wire.

This patch makes the necessary changes to support executing the RPC on
the GPU with multiple threads. This requires some workarounds to mimic
the model when handling the protocol from the CPU. I'm not completely
happy with some of the workarounds required, but I think it should work.

Uses some of the implementation details from D148191.

Reviewed By: JonChesterfield

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

16 months ago[DAGCombiner][RISCV] Enable reassociation for VP_FMA in visitFADDForFMACombine.
Craig Topper [Fri, 5 May 2023 00:20:58 +0000 (17:20 -0700)]
[DAGCombiner][RISCV] Enable reassociation for VP_FMA in visitFADDForFMACombine.

Reviewed By: fakepaper56

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

16 months agoRevert "[Clang][Sema] Fix comparison of constraint expressions"
Alexander Shaposhnikov [Fri, 5 May 2023 00:02:26 +0000 (00:02 +0000)]
Revert "[Clang][Sema] Fix comparison of constraint expressions"

This reverts commit 3a540229341e3c8dc6d8ee61309eafaf943ea254.
A new regression is discovered and needs to be investigated.

16 months ago[RISCV] Add vp.icmp/fcmp to RISCVTargetLowering::canSplatOperand.
Craig Topper [Thu, 4 May 2023 23:56:14 +0000 (16:56 -0700)]
[RISCV] Add vp.icmp/fcmp to RISCVTargetLowering::canSplatOperand.

16 months agoRevert "[lldb] Expose a const iterator for SymbolContextList"
Alex Langford [Thu, 4 May 2023 23:49:30 +0000 (16:49 -0700)]
Revert "[lldb] Expose a const iterator for SymbolContextList"

This reverts commit 04aa943be8ed5c03092e2a90112ac638360ec253.

This broke the debian buildbot and I'm not sure why. Reverting so I can
investigate.

16 months ago[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)
Jonas Devlieghere [Thu, 4 May 2023 16:26:58 +0000 (09:26 -0700)]
[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)

Use templates to simplify {Get,Set}PropertyAtIndex. It has always
bothered me how cumbersome those calls are when adding new properties.
After this patch, SetPropertyAtIndex infers the type from its arguments
and GetPropertyAtIndex required a single template argument for the
return value. As an added benefit, this enables us to remove a bunch of
wrappers from UserSettingsController and OptionValueProperties.

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

16 months ago[lldb] Expose a const iterator for SymbolContextList
Alex Langford [Thu, 4 May 2023 20:26:58 +0000 (13:26 -0700)]
[lldb] Expose a const iterator for SymbolContextList

There are many situations where we'll iterate over a SymbolContextList
with the pattern:
```
SymbolContextList sc_list;
// Fill in sc_list here
for (auto i = 0; i < sc_list.GetSize(); i++) {
  SymbolContext sc;
  sc_list.GetSymbolAtContext(i, sc);

  // Do work with sc
}
```
Adding an iterator to iterate over the instances directly means we don't
have to do bounds checking or create a copy of every element of the
SymbolContextList.

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

16 months ago[libc] Enable linux directory entries syscalls in riscv64
Mikhail R. Gadelha [Thu, 4 May 2023 21:34:01 +0000 (18:34 -0300)]
[libc] Enable linux directory entries syscalls in riscv64

This patch updates the struct dirent to be on par with glibc (by adding
a missing d_type member) and update the readdir call to use SYS_getdents64
instead of SYS_getdents.

Reviewed By: sivachandra

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

16 months ago[mlir][openacc][NFC] Remove braces on single statement bodies
Valentin Clement [Thu, 4 May 2023 22:00:45 +0000 (15:00 -0700)]
[mlir][openacc][NFC] Remove braces on single statement bodies

Update format to stick to https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

16 months ago[libc][rpc] Update locking to work on volta
Jon Chesterfield [Thu, 4 May 2023 21:30:53 +0000 (22:30 +0100)]
[libc][rpc] Update locking to work on volta

Carefully work around not knowing the thread mask that nvptx intrinsic
functions require.

If the warp is converged when calling try_lock, a single rpc call will handle
all lanes within it. Otherwise more than one rpc call with thread masks that
compose to the unknown one will occur.

Reviewed By: jhuber6

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

16 months agoRevert "[libc][rpc] Update locking to work on volta"
Jon Chesterfield [Thu, 4 May 2023 21:44:33 +0000 (22:44 +0100)]
Revert "[libc][rpc] Update locking to work on volta"

This reverts commit b1323738649e96aac943f3773ec7336df110eea5.

16 months ago[libc][rpc] Update locking to work on volta
Jon Chesterfield [Thu, 4 May 2023 21:30:53 +0000 (22:30 +0100)]
[libc][rpc] Update locking to work on volta

Carefully work around not knowing the thread mask that nvptx intrinsic
functions require.

If the warp is converged when calling try_lock, a single rpc call will handle
all lanes within it. Otherwise more than one rpc call with thread masks that
compose to the unknown one will occur.

Reviewed By: jhuber6

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

16 months agoGive NullabilityKind a printing operator<<
Sam McCall [Tue, 2 May 2023 14:22:40 +0000 (16:22 +0200)]
Give NullabilityKind a printing operator<<

This is more useful for debug/test than getNullabilitySpelling:
 - default form has uglifying underscores
 - non-default form crashes on NullableResult
 - both return unhelpfully verbose strings for Unspecified
 - operator<< works with gtest, formatv, etc

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

16 months ago[NFC][HWASAN] Switch to verbose CHECKs
Vitaly Buka [Thu, 4 May 2023 20:56:22 +0000 (13:56 -0700)]
[NFC][HWASAN] Switch to verbose CHECKs

16 months ago[ASan][libcxx] A way to turn off annotations for containers with a specific allocator
Advenam Tacet [Thu, 4 May 2023 21:16:06 +0000 (14:16 -0700)]
[ASan][libcxx] A way to turn off annotations for containers with a specific allocator

This revision is part of our efforts to support container annotations with (almost) every allocator.
That patch is necessary to enable support for most annotations (D136765). Without a way to turn off annotations, it's hard to use ASan with area allocators (no calls to destructors).

This is an answer to a request about it. This patch provides a solution to the aforementioned issue by introducing a new template structure `__asan_annotate_container_with_allocator`, which allows the disabling of container annotations for a specific allocator.

This patch also introduces `_LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS` FTM.

To turn off annotations, it is sufficient to create a template specialization with a false value using a [Unary Type Trait](https://en.cppreference.com/w/cpp/types/integral_constant).

The proposed structure is being used in the code enabling annotations for all allocators in `std::vector`, `std::basic_string`, and `std::deque`. (D136765 D146214 D146815)

Possibility to do it was added to ASan API in rGdd1b7b797a116eed588fd752fbe61d34deeb24e4 commit.

For context on not calling a destructor, look at https://eel.is/c++draft/basic.life#5 and notes there, you may also read a discussion in D136765.

Reviewed By: ldionne, philnik, #libc, hans

Spies: EricWF, mikhail.ramalho, #sanitizers, libcxx-commits, hans, vitalybuka

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

16 months ago[clang][dataflow] Eliminate intermediate `ReferenceValue`s from `Environment::DeclToLoc`.
Martin Braenne [Thu, 4 May 2023 07:42:05 +0000 (07:42 +0000)]
[clang][dataflow] Eliminate intermediate `ReferenceValue`s from `Environment::DeclToLoc`.

For the wider context of this change, see the RFC at
https://discourse.llvm.org/t/70086.

After this change, global and local variables of reference type are associated
directly with the `StorageLocation` of the referenced object instead of the
`StorageLocation` of a `ReferenceValue`.

Some tests that explicitly check for an existence of `ReferenceValue` for a
variable of reference type have been modified accordingly.

As discussed in the RFC, I have added an assertion to `Environment::join()` to
check that if both environments contain an entry for the same declaration in
`DeclToLoc`, they both map to the same `StorageLocation`. As discussed in
https://discourse.llvm.org/t/70086/5, this also necessitates removing
declarations from `DeclToLoc` when they go out of scope.

In the RFC, I proposed a gradual migration for this change, but it appears
that all of the callers of `Environment::setStorageLocation(const ValueDecl &,
SkipPast` are in the dataflow framework itself, and that there are only a few of
them.

As this is the function whose semantics are changing in a way that callers
potentially need to adapt to, I've decided to change the semantics of the
function directly.

The semantics of `getStorageLocation(const ValueDecl &, SkipPast SP` now no
longer depend on the behavior of the `SP` parameter. (There don't appear to be
any callers that use `SkipPast::ReferenceThenPointer`, so I've added an
assertion that forbids this usage.)

This patch adds a default argument for the `SP` parameter and removes the
explicit `SP` argument at the callsites that are touched by this change. A
followup patch will remove the argument from the remaining callsites,
allowing the `SkipPast` parameter to be removed entirely. (I don't want to do
that in this patch so that semantics-changing changes can be reviewed separately
from semantics-neutral changes.)

Reviewed By: ymandel, xazax.hun, gribozavr2

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

16 months ago[SLP][NFC]Do not try to revectorize instructions with constant operands, NFC.
Alexey Bataev [Thu, 4 May 2023 20:32:35 +0000 (13:32 -0700)]
[SLP][NFC]Do not try to revectorize instructions with constant operands, NFC.

The pass should not try to revectorize instructions with constant
operands, which were not folded by the IRBuilder. It prevents the
non-terminating loop in the SLP vectorizer for non foldable constant
operations.

16 months ago[AggressiveInstCombine] Only fold consecutive shifts of loads with constant shift...
Arthur Eubanks [Thu, 4 May 2023 20:07:27 +0000 (13:07 -0700)]
[AggressiveInstCombine] Only fold consecutive shifts of loads with constant shift amounts

This is what the code assumed but never actually checked.

Fixes https://github.com/llvm/llvm-project/issues/62509.

Reviewed By: nikic

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

16 months ago[lldb][NFCI] Add unittests for ObjCLanguage::MethodName
Alex Langford [Thu, 4 May 2023 00:41:58 +0000 (17:41 -0700)]
[lldb][NFCI] Add unittests for ObjCLanguage::MethodName

I have a patch to refactor this class and I'd like a unittest in place
to make sure I don't break anything.

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

16 months agoRevert "[libc][rpc] Land helpers from D148943"
Jon Chesterfield [Thu, 4 May 2023 20:45:18 +0000 (21:45 +0100)]
Revert "[libc][rpc] Land helpers from D148943"

This reverts commit 09ceb4729f1ca8781718d41b7876b68820baadba.

16 months ago[VPlan] Reorder cases in switch (NFC).
Florian Hahn [Thu, 4 May 2023 20:40:22 +0000 (21:40 +0100)]
[VPlan] Reorder cases in switch (NFC).

Reorder cases to make sure they are ordered properly in preparation
for D149081.

16 months agoAdd AArch64 MASK watchpoint support in debugserver
Jason Molenda [Thu, 4 May 2023 20:23:51 +0000 (13:23 -0700)]
Add AArch64 MASK watchpoint support in debugserver

Add suport for MASK style watchpoints on AArch64 in debugserver
on Darwin systems, for watching power-of-2 sized memory ranges.
More work needed in lldb before this can be exposed to the user
(because they will often try watching memory ranges that are not
exactly power-of-2 in size/alignment) but this is the first part
of adding that capability.

Differential Revision: https://reviews.llvm.org/D149792
rdar://108233371

16 months agoRecognize `addressing_bits` kv in stop reply packet
Jason Molenda [Thu, 4 May 2023 20:13:30 +0000 (13:13 -0700)]
Recognize `addressing_bits` kv in stop reply packet

If a remote stub provides the addressing_bits kv pair in
the stop reply packet, update the Process address masks with
that value as it possibly changes during the process runtime.
This is an unusual situation, most likely a JTAG remote stub
and some very early startup code that is setting up the page
tables.  Nearly all debug sessions will have a single address
mask that cannot change during the lifetime of a Process.

Differential Revision: https://reviews.llvm.org/D149803
rdar://61900565

16 months ago[libc][rpc] Land helpers from D148943
Jon Chesterfield [Thu, 4 May 2023 19:53:07 +0000 (20:53 +0100)]
[libc][rpc] Land helpers from D148943

16 months ago[LLDB] Add a hook to notify REPLs that an expression was evaluated
walter erquinigo [Wed, 3 May 2023 02:40:12 +0000 (21:40 -0500)]
[LLDB] Add a hook to notify REPLs that an expression was evaluated

REPL implementations don't have an easy way to know that an expression has been evaluated, so I'm adding a simple function for that. In the future we can add another hook for meta commands.

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

16 months ago[lldb] Make some functions useful to REPLs public
walter erquinigo [Wed, 3 May 2023 02:12:43 +0000 (21:12 -0500)]
[lldb] Make some functions useful to REPLs public

`StartEventHandlerThread` and `StopEventHandlerThread` are available to the SwiftREPL even though they are protected because SwiftREPL is a friend class of Debugger. I'm developing my own REPL and having access to these functions, including `FlushProcessOutput`, is desirable.

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

16 months ago[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.
Ilya Kuklin [Thu, 4 May 2023 19:36:25 +0000 (12:36 -0700)]
[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.

This change will allow to put code pointers in DWARF info fields that are larger than actual pointer size, e.g. 16-bit pointers into 32-bit fields.

The need for this came up while creating support for MSP430 in LLDB. MSP430-GCC already generates DWARF info with 32-bit fields, so this change is necessary for LLDB to maintain compatibility with both GCC and LLVM binaries. Moreover, right now in LLDB there is no support for having DWARF pointer size different from ELF header type, e.g. 16-bit DWARF info within ELF32, and it seems there is no such thing as ELF16.

Since other mainline targets are made to have the same pointer size in both MCAsmInfo and DataLayout, there is no need to change anything there.

Reviewed By: dblaikie

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

16 months ago[llvm-profdata] Change default output format of llvm-profdata to ExtBinary
William Huang [Tue, 2 May 2023 22:35:04 +0000 (22:35 +0000)]
[llvm-profdata] Change default output format of llvm-profdata to ExtBinary

ExtBinary is compatible to, and more superior than Binary format, which is the current default output format. In the long run we are looking to only support ExtBinary format and Text format (for visual inspection), and drop Binary format as well. Since Binary format was the default, we expect many users are still using it, so let's change the default output format first, and hopefully the usage decreases over time

Reviewed By: davidxl, hoy

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

16 months ago[libc] Remove support for atomic test due to failing on sm_60
Joseph Huber [Thu, 4 May 2023 19:12:43 +0000 (14:12 -0500)]
[libc] Remove support for atomic test due to failing on sm_60

This test fails on sm_60 because of the atomics codegen. We test atomics
indirectly with the `rpc` so we still have coverage.

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

16 months agoRevert "[libc] Improve the add_libc_test rule."
Siva Chandra Reddy [Thu, 4 May 2023 19:09:19 +0000 (19:09 +0000)]
Revert "[libc] Improve the add_libc_test rule."

This reverts commit fb6faf4798b1cb327e719898e2ea6eff7f597c49 as the
aarch64 builders are failing.

16 months ago[libc] Improve the add_libc_test rule.
Siva Chandra Reddy [Wed, 3 May 2023 08:00:37 +0000 (08:00 +0000)]
[libc] Improve the add_libc_test rule.

A target for the test named ${fq_target_name} has been added. It depends
on ${fq_target_name}.__unit__ and ${fq_target_name}.__hermetic__ as
relevant.

Reviewed By: jhuber6

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

16 months agodocs: Document policy around GitHub branches
Tom Stellard [Thu, 4 May 2023 18:52:22 +0000 (11:52 -0700)]
docs: Document policy around GitHub branches

See discussion in #56643.

Reviewed By: rengolin, jhenderson, ldionne

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

16 months ago[clang][ExtractAPI] Add semicolon to function declaration fragments
NagaChaitanya Vellanki [Thu, 4 May 2023 18:35:42 +0000 (11:35 -0700)]
[clang][ExtractAPI] Add semicolon to function declaration fragments

Add missing semicolon at the end of function declarations to fragments

Reviewed By: dang

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

16 months ago[libc++][PSTL] Replace _PSTL_ASSERT with _LIBCPP_ASSERT
Nikolas Klauser [Tue, 2 May 2023 22:08:46 +0000 (15:08 -0700)]
[libc++][PSTL] Replace _PSTL_ASSERT with _LIBCPP_ASSERT

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

16 months agoFix build bots due to missing a commit thay change 2b to 23
Shafik Yaghmour [Thu, 4 May 2023 18:23:16 +0000 (11:23 -0700)]
Fix build bots due to missing a commit thay change 2b to 23

Fixing build bot breaks due to b4692f29263006c7ea519c7b11c9082384f0af53

16 months ago[llvm-objdump][COFF] Skip empty export entries when dumping the export table
Alexandre Ganea [Thu, 4 May 2023 17:01:13 +0000 (13:01 -0400)]
[llvm-objdump][COFF] Skip empty export entries when dumping the export table

Before this patch, export entries with empy RVA were displayed in the output. In some cases, when the module had exports with sparse ordinals, `llvm-objdump` used to print a lot of `0 0` lines.
We now skip over these empty entries in the output, just as `dumpbin` or binutils `objdump` does.

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

16 months ago[clang] Fix another case where CPlusPlus2b is still used.
Michael Liao [Thu, 4 May 2023 18:27:33 +0000 (14:27 -0400)]
[clang] Fix another case where CPlusPlus2b is still used.

16 months ago[clang] Fix build after https://reviews.llvm.org/D149553
Michael Liao [Thu, 4 May 2023 18:22:38 +0000 (14:22 -0400)]
[clang] Fix build after https://reviews.llvm.org/D149553

- `CXXPre2bCompat` is referenced somewhere after being removed.
- More warning messages on c++2b need refining

16 months ago[libc] Maintain proper alignment for the hermetic tests malloc
Joseph Huber [Thu, 4 May 2023 16:22:38 +0000 (11:22 -0500)]
[libc] Maintain proper alignment for the hermetic tests malloc

We use a bump pointer to implement malloc for the hermetic tests.
Currently, we bump the pointer up by any amount. This means that calling
`malloc(1)` will misalign the buffer so any following `malloc(8)`
accesses will not be aligned. This causes problems in architectures
which require alignment.

Reviewed By: sivachandra

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

16 months ago[gn build] Fix tblgen CodeGen dependencies
Arthur Eubanks [Thu, 4 May 2023 18:17:55 +0000 (11:17 -0700)]
[gn build] Fix tblgen CodeGen dependencies

Matches the CMake build, otherwise we're rebuilding tblgen (and everything else) when there's a change almost anywhere in LLVM.

16 months ago[MIRParser][nfc] Factor out code parsing debug MD nodes
Felipe de Azevedo Piovezan [Thu, 4 May 2023 16:30:59 +0000 (12:30 -0400)]
[MIRParser][nfc] Factor out code parsing debug MD nodes

This commit splits a function that both parses MD nodes from YAML into
DI{Expr,Loc,Variable} objects AND adds an entry to the MF variable table, so
that each of those jobs is done separately.

It will enable subsequent patches to reuse the MD node parsing code.

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

16 months ago[flang][openacc] Lower data clause on compute construct to data operand ops
Valentin Clement [Thu, 4 May 2023 18:15:04 +0000 (11:15 -0700)]
[flang][openacc] Lower data clause on compute construct to data operand ops

This patch lowers the data clause on the OpenACC compute construct
to their corresponding acc data operand operation.
The decomposition is the same as in D149673.

Note that `private` and `firstprivate` are not lowered to data operand operation as they do not have one and will likely have dedicated design/process.

Depends on D149673

Reviewed By: razvanlupusoru, jeanPerier

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

16 months ago[VPlan] Remove setEntry to avoid leaks when replacing entry.
Florian Hahn [Thu, 4 May 2023 18:12:02 +0000 (19:12 +0100)]
[VPlan] Remove setEntry to avoid leaks when replacing entry.

Update the HCFG builder to directly connect the created CFG to the
existing Plan's entry. This allows removing `setEntry`, which can cause
leaks when the existing entry is replaced.

Should fix
https://lab.llvm.org/buildbot/#/builders/5/builds/33455/steps/13/logs/stdio

16 months agoRestore mlir-opt `--run-reproducer` option to opt-in running a reproducer
Mehdi Amini [Thu, 4 May 2023 16:40:56 +0000 (09:40 -0700)]
Restore mlir-opt `--run-reproducer` option to opt-in running a reproducer

When tooling out there produces a reproducer that is archived, the first thing
a user is likely to expect is to process this as they do with any MLIR file.
However https://reviews.llvm.org/D126447 changed the behavior of mlir-opt to
eliminate the `--run-reproducer` option and instead automatically run it when
present in the input file. This creates a discrepancy in how mlir-opt behaves
when fed with an input file, and is surprising for users.
The explicit passing of `--run-reproducer` to express user-intent seems more
in line with what is expected from `mlir-opt`.

Reviewed By: rriddle, jpienaar

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

16 months ago[Clang] Updating handling of defaulted comparison operators to reflect changes from...
Shafik Yaghmour [Thu, 4 May 2023 18:05:25 +0000 (11:05 -0700)]
[Clang] Updating handling of defaulted comparison operators to reflect changes from P2448R2

Prior to P2448R2 we were more aggressive in diagnosing ill-formed
constexpr functions. Many of these restrictions were relaxed and now it
is not required for defaulted comparison operators to call constexpr
functions.

This behavior is extended to before C++23 and diagnostic for it's use
can be enabled w/ -pedantic or -Wc++2b-default-comp-relaxed-constexpr

This fixes: https://github.com/llvm/llvm-project/issues/61238

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

16 months ago[lldb] Remove unused g_objc_Tagged_ISA constants (NFC)
Dave Lee [Thu, 4 May 2023 17:58:48 +0000 (10:58 -0700)]
[lldb] Remove unused g_objc_Tagged_ISA constants (NFC)

Last use removed in f7420453e80b9294273009efcebaceac2383269e.

16 months ago[libc++][test] Selects proper C++23 field.
Mark de Wever [Sun, 30 Apr 2023 19:23:30 +0000 (21:23 +0200)]
[libc++][test] Selects proper C++23 field.

D149553 changes the name of the LangOptions member. This change allows
libc++ to work with either name.

Reviewed By: philnik, #libc

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

16 months ago[flang][openacc] Lower data construct operand to data operand operations
Valentin Clement [Thu, 4 May 2023 17:36:41 +0000 (10:36 -0700)]
[flang][openacc] Lower data construct operand to data operand operations

This patch lowers the data clause on the OpenACC data construct
to their corresponding acc data operand operation.
The copy clause is decomposed into acc.copyin before and acc.copyout after
the acc.data operation.
The copyout close is decomposed into acc.create before and acc.copyout after
the acc.data operation.
The attach clause is decomposed into acc.attach before and acc.detach after
the acc.data operation.

Depends on D149601

Reviewed By: jeanPerier

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

16 months ago[libc][rpc] Pass lane_mask into lock functions
Jon Chesterfield [Thu, 4 May 2023 17:33:19 +0000 (12:33 -0500)]
[libc][rpc] Pass lane_mask into lock functions

Will be necessary for correct locking on volta.

API-only change to help with rebasing the rest of the stack on this.

Reviewed By: jhuber6

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

16 months ago[BOLT] Remove redundant dumps in AsmDump
Amir Ayupov [Wed, 3 May 2023 23:40:29 +0000 (16:40 -0700)]
[BOLT] Remove redundant dumps in AsmDump

Dumping jump table and tail call fdata is covered by subsequent iteration over
successors.

Reviewed By: #bolt, maksfb

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

16 months ago[mlir][sparse] fix build error.
Peiming Liu [Thu, 4 May 2023 17:20:44 +0000 (17:20 +0000)]
[mlir][sparse] fix build error.

Reviewed By: aartbik, vzakhari

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

16 months ago[clang] Use -std=c++23 instead of -std=c++2b
Mark de Wever [Sun, 30 Apr 2023 13:27:00 +0000 (15:27 +0200)]
[clang] Use -std=c++23 instead of -std=c++2b

During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen.

Reviewed By: aaron.ballman

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

16 months ago[clang][Sema][NFC] Move `EnterExpressionEvaluationContext` to its own file
David Stone [Thu, 4 May 2023 17:06:53 +0000 (13:06 -0400)]
[clang][Sema][NFC] Move `EnterExpressionEvaluationContext` to its own file

Sema.h is huge. This makes a small reduction to it by moving
EnterExpressionEvaluationContext into a new header, since it is an
independent component.

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

16 months agoFix test bot breakage from 06b617064a997574df409c7d846b6f6b492f5124
Alexey Lapshin [Thu, 4 May 2023 16:13:29 +0000 (18:13 +0200)]
Fix test bot breakage from 06b617064a997574df409c7d846b6f6b492f5124

This addresses the issue found by: https://lab.llvm.org/buildbot#builders/178/builds/4571

16 months ago[SLP]Fix a crash trying finding insert point for GEP nodes with non-gep
Alexey Bataev [Thu, 4 May 2023 16:03:02 +0000 (09:03 -0700)]
[SLP]Fix a crash trying finding insert point for GEP nodes with non-gep
insts.

If the vectorizable GEP node is built, which should not be scheduled,
and at least one node is a non-gep instruction, need to insert the
vectorized instructions before the last instruction in the list, not
before the first one, otherwise the instructions may be emitted in the
wrong order.

16 months agoMS inline asm: remove obsolete code adding AOK_SizeDirective (e.g. dword ptr)
Fangrui Song [Thu, 4 May 2023 16:42:25 +0000 (09:42 -0700)]
MS inline asm: remove obsolete code adding AOK_SizeDirective (e.g. dword ptr)

The AOK_SizeDirective part from 5b37c181291210bedfbb7a6af5d51229f3652ef0
(2014-08) seems unneeded nowadays (the root cause has likely been fixed
elsewhere). The part abuses that `call dword ptr foo` assembles the same way as `call
foo` in Intel syntax, which is going to be fixed (changed) by D149579.

The generated object files for
CodeGen/ms-inline-asm{,-functions,-variables,-static-variable}.c and
CodeGenCXX/ms-inline-asm-fields.cpp are unchanged
(-mno-incremental-linker-compatible) with just this patch. When D149579 is
subsequently applied, the FIXME part of `kptr` in
CodeGen/ms-inline-asm-functions.c will be fixed.

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

16 months agoRevert "Restore "[MemProf] Context disambiguation cloning pass [patch 3/4]""
Teresa Johnson [Thu, 4 May 2023 16:37:25 +0000 (09:37 -0700)]
Revert "Restore "[MemProf] Context disambiguation cloning pass [patch 3/4]""

This reverts commit bfe7205975a63a605ff3faacd97fe4c1bf4c19b3, and follow
on fix e3e6bc699574550f2ed1de07f4e5bcdddaa65557, due to some remaining
instability exposed by the bot enabling expensive checks:
https://lab.llvm.org/buildbot/#/builders/42/builds/9842

16 months ago[flang][openacc] Lower copyout, detach and delete to data exit operations
Valentin Clement [Thu, 4 May 2023 16:39:04 +0000 (09:39 -0700)]
[flang][openacc] Lower copyout, detach and delete to data exit operations

Add support to lower data exit operations and use it for the
copyout, detach and delete clause on the `!$acc exit data` construct.

This patch refactor the data entry op creation so most part of the code
can be shared with the data exit op.

Reviewed By: jeanPerier

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

16 months agoRemove obsolete patch for arcanist: this is already in the upstream project now
Mehdi Amini [Thu, 4 May 2023 16:35:25 +0000 (09:35 -0700)]
Remove obsolete patch for arcanist: this is already in the upstream project now

16 months ago[libc++][PSTL] Move all the OpenMP conditionals into a single block
Nikolas Klauser [Tue, 2 May 2023 22:01:00 +0000 (15:01 -0700)]
[libc++][PSTL] Move all the OpenMP conditionals into a single block

All the used OpenMP pragmas are available with OpenMP 4.0, so they can all share a single conditional block.

Reviewed By: ldionne, #libc

Spies: yaxunl, sstefan1, guansong, jplehr, libcxx-commits, sunshaoce

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

16 months agoEntryExitInstrumenter: skip naked functions
Fangrui Song [Thu, 4 May 2023 16:21:18 +0000 (09:21 -0700)]
EntryExitInstrumenter: skip naked functions

The asm in a naked function may reasonably expect the argument registers and the
return address register (if present) to be live.

When using -pg and -finstrument-functions, functions are instrumented by adding
a function call to `_mcount/__cyg_profile_func_enter/__cyg_profile_func_enter_bare`/etc,
which will clobber these registers. If the return address register is clobbered,
the function will be unable to return to the caller, possibly causing an
infinite loop.

```
__attribute__((naked)) void g() {
#if defined(__arm__)
  __asm__("bx lr");
#else
  __asm__("ret");
#endif
}

int main() { g(); }
```

It seems that the only one reasonable way to handle the combination is to
disable instrumenting for naked functions.

GCC PR: https://gcc.gnu.org/PR109707
Close https://github.com/llvm/llvm-project/issues/62504

Reviewed By: hans

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

16 months ago[flang][hlfir] Generate explicit HLFIR type cast for implicit logical<->integer conve...
Slava Zakharin [Thu, 4 May 2023 15:47:28 +0000 (08:47 -0700)]
[flang][hlfir] Generate explicit HLFIR type cast for implicit logical<->integer conversion.

hlfir.assign, in general, ends up calling the Assign runtime that asserts
that the types of LHS and RHS match. In case of implicit logical<->integer
conversions (allowed as an extension) the operands of hlfir.assign
have non-matching types. This change makes sure that the lowering
produces explicit type cast (either as a scalar fir.convert or
as a hlfir.elemental producing array expression).

Reviewed By: jeanPerier

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

16 months ago[mlir][sparse] group tensor id and levels into pairs in loop emitter
Peiming Liu [Mon, 17 Apr 2023 20:09:47 +0000 (20:09 +0000)]
[mlir][sparse] group tensor id and levels into pairs in loop emitter

This addressed some unresolved comments in https://reviews.llvm.org/D142930

Reviewed By: aartbik, wrengr

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

16 months ago[libc++][PSTL][NFC] Fix the naming in the SIMD backend
Nikolas Klauser [Wed, 3 May 2023 21:42:21 +0000 (14:42 -0700)]
[libc++][PSTL][NFC] Fix the naming in the SIMD backend

Reviewed By: ldionne, #libc

Spies: sstefan1, jplehr, libcxx-commits, miyuki

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

16 months ago[OpenMP][OMPIRBuilder] Migrate MapCombinedInfoTy from Clang to OpenMPIRBuilder
Akash Banerjee [Tue, 2 May 2023 17:21:12 +0000 (18:21 +0100)]
[OpenMP][OMPIRBuilder] Migrate MapCombinedInfoTy from Clang to OpenMPIRBuilder

This patch migrates the MapCombinedInfoTy from Clang codegen to OpenMPIRBuilder.

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

16 months ago[VPlan] Clean up preheader block after b85a402dd899fc.
Florian Hahn [Thu, 4 May 2023 15:29:49 +0000 (16:29 +0100)]
[VPlan] Clean up preheader block after b85a402dd899fc.

Fix a leak introduced in b85a402dd899fc and flagged by LSan
https://lab.llvm.org/buildbot#builders/5/builds/33452

16 months ago[libc][Docs] Add warning about running GPU tests with parallelism
Joseph Huber [Thu, 4 May 2023 15:16:54 +0000 (10:16 -0500)]
[libc][Docs] Add warning about running GPU tests with parallelism

Now that a large amount of GPU tests can be run in parallel, we should
document spurious failures. It is a well-known issue that launching many
GPU applications in parallel can lead to various problems, the worst of
which being an indefinite hang.

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

16 months ago[ValueTracking] add UGT/UGE and SGT/SGE in `isImpliedCondOperands`
Siyuan Zhu [Thu, 4 May 2023 14:59:07 +0000 (16:59 +0200)]
[ValueTracking] add UGT/UGE and SGT/SGE in `isImpliedCondOperands`

Partially `fix` https://github.com/llvm/llvm-project/issues/62441.

Extend isImpliedCondOperands() to handle ugt/uge and sgt/sge predicates.

alive2 proof: https://alive2.llvm.org/ce/z/jLFDAv and
https://alive2.llvm.org/ce/z/Z8idUd

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

16 months ago[InstSimplify] Test case for icmp imply (NFC)
Siyuan Zhu [Thu, 4 May 2023 14:57:38 +0000 (16:57 +0200)]
[InstSimplify] Test case for icmp imply (NFC)

ugt/uge/sgt/sge test for the extension to isImpliedCondOperands
case from issue 62441 and 61393:
(X >> Z) <=(u) Y ==> X <=(to u) Y and (X > Y +_{nuw} 1) ==> X != Y

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

16 months ago[compiler-rt][interception][win] Add error messages for some errors
Alvin Wong [Sat, 22 Apr 2023 18:13:48 +0000 (02:13 +0800)]
[compiler-rt][interception][win] Add error messages for some errors

Depends on D149002

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

16 months ago[compiler-rt][interception][asan][win] Improve error reporting
Alvin Wong [Sat, 29 Apr 2023 22:51:48 +0000 (06:51 +0800)]
[compiler-rt][interception][asan][win] Improve error reporting

Add a callback from interception to allow asan on Windows to produce
better error messages. If an unrecoverable error occured when
intercepting functions, print a message before terminating.

Additionally, when encountering unknown instructions, a more helpful
message containing the address and the bytes of the unknown instruction
is now printed to help identify the issue and make it easier to propose
a fix.

Depends on D149549

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

16 months ago[compiler-rt][interception][win] Don't crash on unknown instructions
Alvin Wong [Sat, 22 Apr 2023 18:04:16 +0000 (02:04 +0800)]
[compiler-rt][interception][win] Don't crash on unknown instructions

Do not treat unknown instructions as a fatal error. In most cases,
failure to intercept a function is reported by the caller, though
requires setting verbosity to 1 or higher to be visible.

Better error message reporting for asan will be added in a separate
patch.

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

16 months ago[compiler-rt][asan][win] Intercept exceptions for i686 MinGW
Alvin Wong [Sat, 22 Apr 2023 12:54:33 +0000 (20:54 +0800)]
[compiler-rt][asan][win] Intercept exceptions for i686 MinGW

The i686-w64-windows-gnu target does not use SEH (which MSVC uses),
but DWARF-2 exception handling or possibly sjlj depending on the
toolchain build options. On this target we have to actually intercept
functions in libc++ and libunwind which handles throwing exceptions.
This fixes the `TestCases/intercept-rethrow-exception.cpp` test.

The x86_64-w64-windows-gnu target already works because it uses SEH
which is handled by intercepting RaiseException, so this change does not
affect x86_64.

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

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

16 months ago[compiler-rt][interception][win] Add more assembly patterns
Alvin Wong [Sat, 22 Apr 2023 11:26:08 +0000 (19:26 +0800)]
[compiler-rt][interception][win] Add more assembly patterns

These assembly patterns are needed to intercept some libc++ and
libunwind functions built by Clang for i686-w64-windows-gnu target.

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

16 months ago[libc++] Add missing test for std::hash<std::filesystem::path>
Louis Dionne [Tue, 2 May 2023 21:50:06 +0000 (17:50 -0400)]
[libc++] Add missing test for std::hash<std::filesystem::path>

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

16 months ago[MemProf] Need to require asserts for tests that use -stats
Teresa Johnson [Thu, 4 May 2023 14:32:50 +0000 (07:32 -0700)]
[MemProf] Need to require asserts for tests that use -stats

Follow up to bfe7205975a63a605ff3faacd97fe4c1bf4c19b3 to require asserts
which is needed for the use of -stats. This showed up in the following
bot failure: https://lab.llvm.org/buildbot/#/builders/91/builds/16760

16 months ago[DAGCombiner] Use generalized pattern match for visitFSUBForFMACombine.
Yeting Kuo [Thu, 4 May 2023 06:59:03 +0000 (14:59 +0800)]
[DAGCombiner] Use generalized pattern match for visitFSUBForFMACombine.

The patch makes visitFSUBForFMACombine serve vp.fsub too. It helps DAGCombiner
to fuse vp.fsub and vp.fmul patterns to vp.fma.

Reviewed By: luke

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

16 months agoAdd the experiemental interpreter to the open project page
Aaron Ballman [Thu, 4 May 2023 13:40:35 +0000 (09:40 -0400)]
Add the experiemental interpreter to the open project page

This also fixes a missing close li tag as a drive-by

16 months ago[libc] Enable running libc unit tests on NVPTX
Joseph Huber [Fri, 28 Apr 2023 09:33:44 +0000 (04:33 -0500)]
[libc] Enable running libc unit tests on NVPTX

The previous patches added the necessary support for global constructors
used to register tests. This patch enables the NVPTX target to build
and run the unit tests on the GPU. Currently this only tests the ctype
tests, but adding more should be straightforward from here on.

This ran all the ctest unit tests when run on an sm_70.

Depends on D149517 D149527

Reviewed By: sivachandra

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

16 months ago[CMake] Install FindLibEdit find module
Eric Kilmer [Thu, 4 May 2023 13:23:47 +0000 (13:23 +0000)]
[CMake] Install FindLibEdit find module

This is a follow-up to D147153 and addresses CMake warnings about not
finding LibEdit find module when another project uses LLVM as a
dependency.

Fixes https://github.com/llvm/llvm-project/issues/62300

Reviewed By: Dinistro

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

16 months agoRestore "[MemProf] Context disambiguation cloning pass [patch 3/4]"
Teresa Johnson [Wed, 3 May 2023 23:09:53 +0000 (16:09 -0700)]
Restore "[MemProf] Context disambiguation cloning pass [patch 3/4]"

This reverts commit 6fbf022908c104a380fd1854fb96eafc64509366, restoring
commit bf6ff4fd4b735afffc65f92a4a79f6610e7174c3 with a fix for a bot
failure due to a previously unstable iteration order.

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

16 months ago[clang][dataflow][NFC] Eliminate unnecessary helper `stripReference()`.
Martin Braenne [Wed, 3 May 2023 13:20:31 +0000 (13:20 +0000)]
[clang][dataflow][NFC] Eliminate unnecessary helper `stripReference()`.

`QualType::getNonReferenceType()` does the same thing.

Reviewed By: sammccall

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

16 months ago[Coverity] Improper use of negtive value.
Luo, Yuanke [Thu, 4 May 2023 12:58:21 +0000 (20:58 +0800)]
[Coverity] Improper use of negtive value.

The `Iteration` value may be -1 which would cause incorrect loop count
when pass the value to buildSqrtNROneConst or buildSqrtNRTwoConst.

16 months ago[X86] Support llvm.{min,max}imum.f{16,32,64}
Evgenii Kudriashov [Thu, 4 May 2023 12:25:31 +0000 (20:25 +0800)]
[X86] Support llvm.{min,max}imum.f{16,32,64}

Addresses https://github.com/llvm/llvm-project/issues/53353

Reviewed By: RKSimon, pengfei

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

16 months ago[NFC][X86] Remove cfi instructions and unused attributes from half.ll test
Evgenii Kudriashov [Thu, 4 May 2023 12:25:51 +0000 (20:25 +0800)]
[NFC][X86] Remove cfi instructions and unused attributes from half.ll test

Reviewed By: RKSimon

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

16 months ago[VPlan] Introduce new entry block to VPlan for early SCEV expansion.
Florian Hahn [Thu, 4 May 2023 13:00:13 +0000 (14:00 +0100)]
[VPlan] Introduce new entry block to VPlan for early SCEV expansion.

This patch adds a new preheader block the VPlan to place SCEV expansions
expansions like the trip count. This preheader block is disconnected
at the moment, as the bypass blocks of the skeleton are not yet modeled
in VPlan.

The preheader block is executed before skeleton creation, so the SCEV
expansion results can be used during skeleton creation. At the moment,
the trip count expression and induction steps are expanded in the new
preheader. The remainder of SCEV expansions will be moved gradually in
the future.

D147965 will update skeleton creation to use the steps expanded in the
pre-header to fix #58811.

Reviewed By: Ayal

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

16 months ago[libc][rpc] Factor try_lock, unlock into functions on Process
Jon Chesterfield [Thu, 4 May 2023 12:58:24 +0000 (13:58 +0100)]
[libc][rpc] Factor try_lock, unlock into functions on Process

Reduces line noise and localises changes needed for volta

Reviewed By: jhuber6

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

16 months ago[mlir][mem2reg] Add support for mem2reg in MemRef.
Théo Degioanni [Thu, 4 May 2023 12:44:07 +0000 (12:44 +0000)]
[mlir][mem2reg] Add support for mem2reg in MemRef.

This patch implements the mem2reg interfaces for MemRef types. This only supports scalar memrefs of a small list of types. It would be beneficial to create more interfaces for default values before expanding support to more types. Additionally, I am working on an upcoming revision to bring SROA to MLIR that should help with non-scalar memrefs.

Reviewed By: gysit, Mogball

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

16 months ago[mlir][emitc][nfc] Update ApplyOp example
Marius Brehler [Thu, 4 May 2023 12:38:14 +0000 (12:38 +0000)]
[mlir][emitc][nfc] Update ApplyOp example

16 months agoMove LLT::dump()'s impl to LowLevelType.cpp
NAKAMURA Takumi [Thu, 4 May 2023 12:27:08 +0000 (21:27 +0900)]
Move LLT::dump()'s impl to LowLevelType.cpp

Suggested by @jobnoorman
https://reviews.llvm.org/D148767#4317848

16 months ago[gn build] Port f05ce9045af4
LLVM GN Syncbot [Thu, 4 May 2023 12:14:42 +0000 (12:14 +0000)]
[gn build] Port f05ce9045af4

16 months ago[libc] Support global constructors and destructors on NVPTX
Joseph Huber [Fri, 28 Apr 2023 14:33:44 +0000 (09:33 -0500)]
[libc] Support global constructors and destructors on NVPTX

This patch adds the necessary hacks to support global constructors and
destructors. This is an incredibly hacky process caused by the primary
fact that Nvidia does not provide any binary tools and very little
linker support. We first had to emit references to these functions and
their priority in D149451. Then we dig them out of the module once it's
loaded to manually create the list that the linker should have made for
us. This patch also contains a few Nvidia specific hacks, but it passes
the test, albeit with a stack size warning from `ptxas` for the
callback. But this should be fine given the resource usage of a common
test.

This also adds a dependency on LLVM to the NVPTX loader, which hopefully doesn't
cause problems with our CUDA buildbot.

Depends on D149451

Reviewed By: tra

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

16 months ago[NVPTX] Add NVPTXCtorDtorLoweringPass to handle global ctors / dtors
Joseph Huber [Fri, 28 Apr 2023 11:16:05 +0000 (06:16 -0500)]
[NVPTX] Add NVPTXCtorDtorLoweringPass to handle global ctors / dtors

This patch mostly adapts the existing AMDGPUCtorDtorLoweringPass for use
by the Nvidia backend. This pass transforms the ctor / dtor list into a
kernel call that can be used to invoke those functinos. Furthermore, we
emit globals such that the names and addresses of these constructor
functions can be found by the driver. Unfortunately, since NVPTX has no
way to emit variables at a named section, nor a functioning linker to
provide the begin / end symbols, we need to mangle these names and have
an external application find them.

This work is related to the work in D149398 and D149340.

Reviewed By: tra

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