Commit Graph

520601 Commits

Author SHA1 Message Date
Louis Dionne
b23fc2c5bf [libc++abi] Fix broken check for _LIBCPP_HAS_THREAD_API_PTHREAD (#118999)
We were still using the old `defined(_LIBCPP_HAS_THREAD_API_PTHREAD)`
check, which is always true.
2024-12-06 15:30:02 -05:00
joaosaffran
1df28554bd [HLSL] Add ByteAddressBuffer, RWByteAddressBuffer and RasterizerOrderedByteAddressBuffer definitions to HLSLExternalSemaSource #113477 (#116699)
This is the first one in a series of PRs adding the requirements for
#58654

This PR adds `ByteAddressBuffer`, `RWByteAddressBuffer ` and
`RasterizerOrderedByteAddressBuffer ` definitions as well as their
handle lowering to `dx.RawBuffer`.

closes #58654

---------

Co-authored-by: Joao Saffran <jderezende@microsoft.com>
2024-12-06 12:19:39 -08:00
Kazu Hirata
c5e4e8f87d [memprof] Add IndexedMemProfData::addCallStack (#118920)
This patch adds a helper function to replace an idiom like:

  CallStackId CSId = hashCallStack(CallStack)
  MemProfData.CallStacks.try_emplace(CSId, CallStack);
  // Do something with CSId.
2024-12-06 12:10:11 -08:00
Michael Maitland
131b7fe2b1 [RISCV][VLOPT] Add support for widening integer mul-add instructions (#112219)
This adds support for these instructions and also tests getOperandInfo
for these instructions as well. I think the VL on the using add
instruction can be optimized further, once we add support for optimizing
non-vlmax.
2024-12-06 15:03:43 -05:00
Craig Topper
ab0dc290bc [RISCV][GISel] Allow s32 G_PHI for RV64 to support f32 phis. 2024-12-06 11:53:57 -08:00
Florian Hahn
7f7f540a48 Reapply "[VPlan] Update scalar induction resume values in VPlan. (#110577)"
This reverts commit f09b16e267.

The crash when building llvm-test-suite with stage2 should have been
fixed by 1091fad31a.
2024-12-06 19:41:51 +00:00
Chris Apple
ca3180ad6e [LLVM][rtsan] Add module pass to initialize rtsan (#118989)
This allows shared libraries instrumented with RTSan to be initialized.

This approach directly mirrors the approach in Tsan, Asan and many of
the other sanitizers
2024-12-06 11:29:11 -08:00
Philip Reames
3c83054bec [RISCV] Add tests for suboptimal interleave patterns
Upcoming changes will improve codegen in these cases per the included
TOOOs.
2024-12-06 11:14:38 -08:00
Michael Maitland
84efad0b47 [RISCV][MRI] Account for fixed registers when determining callee saved regs (#115756)
This fixes
https://discourse.llvm.org/t/fixed-register-being-spill-and-restored-in-clang/83058.

We need to do it in `MachineRegisterInfo::getCalleeSavedRegs` instead of
`RISCVRegisterInfo::getCalleeSavedRegs` since the MF argument of
`TargetRegisterInfo:::getCalleeSavedRegs` is `const`, so we can't call
`MF->getRegInfo().disableCalleeSavedRegister` there.

So to put it in `MachineRegisterInfo::getCalleeSavedRegs`, we move
`isRegisterReservedByUser` into `TargetSubtargetInfo`.
2024-12-06 14:07:27 -05:00
LLVM GN Syncbot
1d95825d4d [gn build] Port 12bdeba76e 2024-12-06 18:34:46 +00:00
Haowei Wu
12bdeba76e Revert "[Serialization] Support load lazy specialization lazily"
This reverts commit b5bd192111.
It brokes multiple llvm bots including clang-x64-windows-msvc
2024-12-06 10:33:57 -08:00
Michał Górny
4a44e4b192 [offload] Remove bogus offload-tblgen check for standalone build (#119004)
fd3907ccb5 introduced a check for system
offload-tblgen executable when doing a standalone build. This check is
bogus, since offload-tblgen is built as part of offload and not some
other preinstalled component. The path is also overwritten below, so the
check only causes tests to be disabled unnecessarily.
2024-12-06 18:21:12 +00:00
Thirumalai Shaktivel
e73ec1a74a [Flang][OpenMP] Add some semantic checks for Linear clause (#111354)
This PR adds all the missing semantics for the Linear clause based on
the OpenMP 5.2 restrictions. The restriction details are mentioned
below.

OpenMP 5.2:
5.4.6 linear Clause restrictions
- A linear-modifier may be specified as ref or uval only on a declare
simd directive.
- If linear-modifier is not ref, all list items must be of type integer.
- If linear-modifier is ref or uval, all list items must be dummy
arguments without the VALUE attribute.
- List items must not be Cray pointers or variables that have the
POINTER attribute. Cray pointer support has been deprecated.
- If linear-modifier is ref, list items must be polymorphic variables,
assumed-shape arrays, or variables with the ALLOCATABLE attribute.
- A common block name must not appear in a linear clause.
- The list-item cannot appear more than once

4.4.4 ordered Clause restriction
- If n is explicitly specified, a linear clause must not be specified on
the same directive.

5.11 aligned Clause restriction
- Each list item must have C_PTR or Cray pointer type or have the
POINTER or ALLOCATABLE attribute. Cray pointer support has been
deprecated.
2024-12-06 12:11:46 -06:00
Krzysztof Parzyszek
02db35a1d6 [flang][OpenMP] Implement CheckReductionObjects for all reduction c… (#118689)
…lauses

Currently we only do semantic checks for REDUCTION. There are two other
clauses, IN_REDUCTION, and TASK_REDUCTION which will also need those
checks. Implement a function that checks the common list-item
requirements for all those clauses.
2024-12-06 12:00:48 -06:00
Momchil Velikov
7f4414b2a1 [AArch64] Generate zeroing forms of certain SVE2.2 instructions (4/11) (#116830)
SVE2.2 introduces instructions with predicated forms with zeroing of
the inactive lanes. This allows in some cases to save a `movprfx` or
a `mov` instruction when emitting code for `_x` or `_z` variants of
intrinsics.

This patch adds support for emitting the zeroing forms of certain
`FCVTZS`, and `FCVTZU` instructions.
2024-12-06 17:50:20 +00:00
Schrodinger ZHU Yifan
39451e45f5 [libc][CPP] clean up and generalize atomic implementation (#118996) 2024-12-06 12:47:19 -05:00
Benjamin Maxwell
bded889014 [clang][AArch64] Fix C++11 style initialization of typedef'd vectors (#118956)
Previously, this hit an `llvm_unreachable()` assertion as the type of
`vec_t` did not exactly match `__SVInt8_t`, as it was wrapped in a
typedef.

Comparing the canonical types instead allows the types to match
correctly and avoids the crash.

Fixes #107609
2024-12-06 17:27:46 +00:00
Alexey Bataev
b9aa155d26 [TTI][X86]Fix detection of the shuffles from the second shuffle operand only
If the shuffle mask uses only indices from the second shuffle operand,
processShuffleMasks function misses it currently, which prevents correct
cost estimation in this corner case. To fix this, need to raise the
limit to 2 * VF rather than just VF and adjust processing
correspondingly. Will allow future improvements for 2 sources
permutations.

Reviewers: RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/118972
2024-12-06 12:27:00 -05:00
Ellis Hoag
2e33ed9ecc [memprof] Use -memprof-runtime-default-options to set options during compile time (#118874)
Add the `__memprof_default_options_str` variable, initialized via the
`-memprof-runtime-default-options` LLVM flag, to hold the default options string
for memprof. This allows us to set these options during compile time in
the clang invocation.

Also update the docs to describe the various ways to set these options.
2024-12-06 09:22:16 -08:00
Matt Arsenault
d42ab5d0f0 SystemZ: Regenerate baseline checks for some coalescer tests (#118322)
These were missing -NEXT checks and also had some dead checks.
Also switch a test to actually check the output.
2024-12-06 12:18:51 -05:00
Philip Reames
dff47d944d [RISCV] Add coverage for deinterleave with only subvector used 2024-12-06 09:08:46 -08:00
erichkeane
009b5e8e59 [OpenACC] 'vector' clause implementation for combined constructs
Similar to 'worker', the 'vector' clause has some rules that needed to
be applied on its argument legality that for combined constructs need to
look at the current construct, not the 'effective' parent construct.
Additionally, it has some interaction with `vector_length` that needed
to be encoded as well.  This patch implements it.
2024-12-06 09:06:57 -08:00
Nikita Popov
f09b16e267 Revert "[VPlan] Update scalar induction resume values in VPlan. (#110577)"
This reverts commit 0678e20583.
This reverts commit 1091fad31a.

Causes crashes in llvm-test-suite when using stage 2 clang.
2024-12-06 18:01:42 +01:00
Florian Hahn
1091fad31a [VPlan] Fix stack-use-after-scope in VPInstruction::generate (NFC).
Fix stack-use-after-scope introduced in 0678e20583 by pulling out
the vector to a dedicated variable.

Should fix ASan/MSan failures, including
https://lab.llvm.org/buildbot/#/builders/169/builds/6111.
2024-12-06 16:50:54 +00:00
David Spickett
a46ee733d2 [lldb] Fix off by one in array index check in Objective C runtime plugin (#118995)
Reported in #116944 / https://pvs-studio.com/en/blog/posts/cpp/1188/.
2024-12-06 16:40:57 +00:00
Florian Hahn
4f7f71b7bc [VPlan] Compare APInt instead of getSExtValue to fix crash in unroll.
getSExtValue assumes the result fits in 64 bits, but this may not be the
case for indcutions with wider types. Instead, directly perform the
compare on the APInt for the ConstantInt.

Fixes https://github.com/llvm/llvm-project/issues/118850.
2024-12-06 16:28:49 +00:00
Simon Pilgrim
9ad22cf0ee [X86] lowerV32I16Shuffle - attempt to fold unary shuffle to lane permute + repeated mask
Fixes #79799
2024-12-06 16:25:15 +00:00
Simon Pilgrim
6bc3c9ee6b [X86] combineX86ShuffleChain - always create VPERMV3 nodes if started from a VPERMV3 node
If the root shuffle node was a VPERMV3 node, then we can always replace it with a new VPERMV3 node - it doesn't matter if other variable shuffles in the chain had multiple uses.
2024-12-06 16:25:15 +00:00
Simon Pilgrim
140680c5c8 [X86] Add peephole for (add (concat_vectors vpmaddwd, vpmaddwd)) -> vpdpwssd on VNNI targets
Cleanup for #118433
2024-12-06 16:25:14 +00:00
jeanPerier
d6ec7c82f3 [flang][CUF] fix missing header after #112188 (#118993)
Otherwise, builds with `-DFLANG_CUF_RUNTIME` hits:

```
runtime/CUDA/descriptor.cpp:44:24: error: invalid use of incomplete type 'const class Fortran::runtime::Descriptor'
   44 |   std::size_t count{src->SizeInBytes()};
```
2024-12-06 17:22:47 +01:00
Ping Charoenwet
e68a3e4d0d [lldb] Fix typos in StackFrame.cpp (#118991) 2024-12-06 16:08:08 +00:00
Jay Foad
33f4f39725 [AMDGPU] New GFX11 v_cmp_tru_* aliases for integer comparisons (#118976)
This is for compatibility with SP3. It only affects GFX11 because the
v_cmp_t_* instructions were removed in GFX12.
2024-12-06 15:36:37 +00:00
Jay Foad
807726fce4 [AMDGPU] New aliases v_add3_nc_u32 and v_xor_add_u32 (#118970)
This is for compatibility with SP3.
2024-12-06 15:35:57 +00:00
Jay Foad
3f3bcac53e [AMDGPU] New alias v_interp_p2_new_f32 (#118968)
This is for compatibility with SP3. Also add basic testing for the new
GFX11 VINTERP encoding.
2024-12-06 15:35:32 +00:00
Matt Arsenault
c74e2232f2 AMDGPU: Simplify demanded bits on readlane/writeline index arguments (#117963)
The main goal is to fold away wave64 code when compiled for wave32.
If we have out of bounds indexing, these will now clamp down to
a low bit which may CSE with the operations on the low half of the
wave.
2024-12-06 10:31:14 -05:00
Yingwei Zheng
5fa59edfa7 [ConstraintElim] Add support for trunc nsw/nuw (#118745)
Proof for `trunc nsw nneg X -> trunc nuw X`:
https://alive2.llvm.org/ce/z/ooP6Mt
2024-12-06 23:15:31 +08:00
VladiKrapp-Arm
bb3eb0ca0c [ARM] Test unroll behaviour on machines with low overhead branching (#118692)
Add test for existing loop unroll behaviour.

Current behaviour is the single loop with fmul gets runtime unrolled by
count of 4, with the loop remainder unrolled as the 3 for.body9.us.prol
sections. This is quite a lot of compare and branch, negating the
benefits of the low overhead loop mechanism.
2024-12-06 15:04:56 +00:00
David Olsen
a43b2e13f9 [CIR] Integral types; simple global variables (#118743)
Add integral types to ClangIR. These are the first ClangIR types, so the
change includes some infrastructure for managing ClangIR types.

So that the integral types can be used somewhere, generate ClangIR for
global variables using the new `cir.global` op. As with the current
support for functions, global variables are just a stub at the moment.
The only properties that global variables have are a name and a type.

Add a new ClangIR code gen test global-var-simple.cpp, which defines
global variables with most of the integral types.

(Part of upstreaming the ClangIR incubator project into LLVM.)
2024-12-06 07:01:09 -08:00
David Spickett
1bdb0a408f [libcxx] Add Maintainers.md file 2024-12-06 14:52:23 +00:00
Timm Baeder
2f9cd43a73 [clang][bytecode] Check primitive bit casts for indeterminate bits (#118954)
Record bits ranges of initialized bits and check them in
allInitialized().
2024-12-06 15:50:59 +01:00
kadir çetinkaya
d74214cc8c [clang][NFC] Change suppression mapping interfaces to use SourceLocation (#118960)
This way we can delay getting a presumed location even further, only
performing it for diagnostics that are mapped.
2024-12-06 15:50:32 +01:00
Michael Kruse
c91ba04328 [Flang][NFC] Split runtime headers in preparation for cross-compilation. (#112188)
Split some headers into headers for public and private declarations in
preparation for #110217. Moving the runtime-private headers in
runtime-private include directory will occur in #110298.

* Do not use `sizeof(Descriptor)` in the compiler. The size of the
descriptor is target-dependent while `sizeof(Descriptor)` is the size of
the Descriptor for the host platform which might be too small when
cross-compiling to a different platform. Another problem is that the
emitted assembly ((cross-)compiling to the same target) is not identical
between Flang's running on different systems. Moving the declaration of
`class Descriptor` out of the included header will also reduce the
amount of #included sources.

* Do not use `sizeof(ArrayConstructorVector)` and
`alignof(ArrayConstructorVector)` in the compiler. Same reason as with
`Descriptor`.

* Compute the descriptor's extra flags without instantiating a
Descriptor. `Fortran::runtime::Descriptor` is defined in the runtime
source, but not the compiler source.

* Move `InquiryKeywordHashDecode` into runtime-private header. The
function is defined in the runtime sources and trying to call it in the
compiler would lead to a link-error.

* Move allocator-kind magic numbers into common header. They are the
only declarations out of `allocator-registry.h` in the compiler as well.
 
This does not make Flang cross-compile ready yet, the main goal is to
avoid transitive header dependencies from Flang to clang-rt. There are
more assumptions that host platform is the same as the target platform.
2024-12-06 15:29:00 +01:00
Mehdi Amini
1801fb4bd3 [MLIR] Fixes arith.sub folder crash on dynamically shaped tensors (#118908)
We can't create a constant for a value with dynamic shape.

Fixes #118772
2024-12-06 06:24:28 -08:00
Shilei Tian
92376c3ff5 [Offload][OMPX] Add the runtime support for multi-dim grid and block (#118042) 2024-12-06 09:07:50 -05:00
Ties Stuij
2f4eac6287 [clang][ARM] disable frame pointers by default for bare metal ARM targets (#117140)
because:
- This brings Clang in line with GCC for which this is the default for ARM
- It frees up a register, so performance increase, especially on Thumb/6-M
- It will decrease code size
2024-12-06 14:05:30 +00:00
Peng Liu
37797d3e80 [libc++][test] Fix and refactor exception tests for std::vector constructors (#117662)
The existing exceptions tests for `vector<T>` have several issues: some
tests did not throw exceptions at all, making them not useful for
exception-safety testing, and some tests did not throw exceptions at the
intended points, failing to serve their expected purpose. This PR fixes
those tests for vector's constructors. Morever, this PR extracted common
classes and utilities into a separate header file, and renamed those
classes using more descriptive names.
2024-12-06 09:03:17 -05:00
Jefferson Le Quellec
952c5156e6 [Driver][OpenMP] Fix OpenMP target-toolchain-option parser (#115375)
## Description

This PR fixes a segmentation fault that occurs when passing options
requiring arguments via `-Xopenmp-target=<triple>`. The issue was that
the function `Driver::getOffloadArchs` did not properly parse the
extracted option, but instead assumed it was valid, leading to a crash
when incomplete arguments were provided.

## Backtrace

```sh
llvm-project/build/bin/clang++ main.cpp -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target=powerpc64le-ibm-linux-gnu -o 
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: llvm-project/build/bin/clang++ main.cpp -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target=powerpc64le-ibm-linux-gnu -o
1.      Compilation construction
2.      Building compilation actions
 #0 0x0000562fb21c363b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (llvm-project/build/bin/clang+++0x392f63b)
 #1 0x0000562fb21c0e3c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fcbf6c81420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x0000562fb1fa5d70 llvm::opt::Option::matches(llvm::opt::OptSpecifier) const (llvm-project/build/bin/clang+++0x3711d70)
 #4 0x0000562fb2a78e7d clang::driver::Driver::getOffloadArchs(clang::driver::Compilation&, llvm::opt::DerivedArgList const&, clang::driver::Action::OffloadKind, clang::driver::ToolChain const*, bool) const (llvm-project/build/bin/clang+++0x41e4e7d)
 #5 0x0000562fb2a7a9aa clang::driver::Driver::BuildOffloadingActions(clang::driver::Compilation&, llvm::opt::DerivedArgList&, std::pair<clang::driver::types::ID, llvm::opt::Arg const*> const&, clang::driver::Action*) const (.part.1164) Driver.cpp:0:0
 #6 0x0000562fb2a7c093 clang::driver::Driver::BuildActions(clang::driver::Compilation&, llvm::opt::DerivedArgList&, llvm::SmallVector<std::pair<clang::driver::types::ID, llvm::opt::Arg const*>, 16u> const&, llvm::SmallVector<clang::driver::Action*, 3u>&) const (llvm-project/build/bin/clang+++0x41e8093)
 #7 0x0000562fb2a8395d clang::driver::Driver::BuildCompilation(llvm::ArrayRef<char const*>) (llvm-project/build/bin/clang+++0x41ef95d)
 #8 0x0000562faf92684c clang_main(int, char**, llvm::ToolContext const&) (llvm-project/build/bin/clang+++0x109284c)
 #9 0x0000562faf826cc6 main (llvm-project/build/bin/clang+++0xf92cc6)
#10 0x00007fcbf6699083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#11 0x0000562faf923a5e _start (llvm-project/build/bin/clang+++0x108fa5e)
[1]    2628042 segmentation fault (core dumped)   main.cpp -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu  -o
```
2024-12-06 09:02:05 -05:00
cmtice
384e69a914 [libc++] Add _LIBCPP_NODEBUG on internal allocator trait aliases (#118835)
Put _LIBCPP_NODEBUG on the new allocator trait aliases introduced in
https://github.com/llvm/llvm-project/pull/115654. This prevents a large
increase in the gdb_index size that was introduced by that PR.
2024-12-06 08:53:56 -05:00
Nikita Popov
ae73bc8e94 Reapply [InstCombine] Support gep nuw in icmp folds (#118472)
The profile runtime test failure this caused has been addressed in:
https://github.com/llvm/llvm-project/pull/118782

-----

Unsigned icmp of gep nuw folds to unsigned icmp of offsets. Unsigned
icmp of gep nusw nuw folds to unsigned samesign icmp of offsets.

Proofs: https://alive2.llvm.org/ce/z/VEwQY8
2024-12-06 14:41:10 +01:00
Simon Pilgrim
1885886b3f [X86] matchIndexRecursively - fix incorrect signed/unsigned constant creation
Fixes #118934
2024-12-06 13:36:43 +00:00