Commit Graph

535658 Commits

Author SHA1 Message Date
Vitaly Buka
b111da97e8 [NFC][asan] Try to deflake asan_lsan_deadlock test (#137718)
10s looks not enough. With highly parallel test
execution on VMs it's very possible that Asan
report will have no enough time to produce output.

I can reproduce locally 1s is not always enough,
but likely my workstation is faster then buildbot.

Additionally, don't use puts/CHECK to validate
timeout. We can exit with 0 and it should violate
"not" expectation.

Follow up to #131756.
2025-04-28 15:17:51 -07:00
Alexey Bataev
ea1b525ceb [LAA] Add tests with non-power-of-2 store-load forward distance (#136710) 2025-04-28 15:10:55 -07:00
Bruno Cardoso Lopes
a5024cd0d7 [MLIR][LLVM] More on CG Profile: support null function entries (#137269) 2025-04-28 15:03:09 -07:00
Alexander Kornienko
b509f7cca5 Revise CK_NullToPointer comment
This addresses a post-commit review comment in https://github.com/llvm/llvm-project/pull/137364#discussion_r2064772853.
2025-04-28 23:45:31 +02:00
Alexey Bataev
88f8637d22 Revert "[LAA] Add tests with non-power-of-2 store-load forward distance (#136710)"
This reverts commit 51bbebb667 to fix
buildbots https://lab.llvm.org/buildbot/#/builders/137/builds/17662
2025-04-28 14:36:44 -07:00
Jonas Devlieghere
7d4e6ff216 [lldb-dap] Bump the version to 0.2.13 2025-04-28 14:11:01 -07:00
Felipe de Azevedo Piovezan
b73169ad3e [lldb] Disable TestDAP_attachByPortNum
This test is flaky and creating a lot of noise in CI.
See https://github.com/llvm/llvm-project/issues/137660
2025-04-28 14:08:14 -07:00
John Harrison
4fa0f1d166 [lldb-dap] Adding an icon to the lldb-dap package. (#137695)
This shows up in the extension UI and in the VSCode extension
marketplace.

I used the llvm/llvm-www/blob/main/img/LLVMWyvernSmall.png for the
image.

Here is what this looks like locally: 
<img width="1020" alt="Screenshot 2025-04-28 at 12 30 33 PM"
src="https://github.com/user-attachments/assets/cd615161-06db-4a37-8f8a-df65ca620a67"
/>
2025-04-28 14:02:36 -07:00
Alexey Bataev
51bbebb667 [LAA] Add tests with non-power-of-2 store-load forward distance (#136710) 2025-04-28 17:02:02 -04:00
Florian Hahn
d2ce88a939 [VPlan] Create initial skeleton before creating regions. (NFC)
Move out the logic to prepare for vectorization to a separate transform,
before creating loop regions. This was discussed as follow-up
in https://github.com/llvm/llvm-project/pull/136455.

This just moves the existing code around slightly  and will simplify
follow-up patches to include the exiting edges during initial VPlan
construction.
2025-04-28 21:51:32 +01:00
Amr Hesham
e12ff331f1 [CIR] Standardize element type name between Array and Vector Types (#137465)
Standardize the element type name
2025-04-28 22:50:48 +02:00
Tom Stellard
59978b21ad [sanitizer_common] Remove interceptors for deprecated struct termio (#137403)
This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes #137321
2025-04-28 13:45:11 -07:00
Justin Bogner
f9855917f6 [HLSL] Treat classes and structs as packed by default (#137391)
Fixes #121010.
2025-04-28 13:44:46 -07:00
Krzysztof Parzyszek
9ea5254f77 [flang][OpenACC][OpenMP] Separate implementations of ATOMIC constructs (#137517)
The OpenMP implementation of the ATOMIC construct will change in the
near future to accommodate atomic conditional-update and conditional-
update-capture operations. This patch separates the shared implemen-
tations to avoid interfering with OpenACC.
2025-04-28 15:43:39 -05:00
Susan Tan (ス-ザン タン)
dfdc50be8e [mlir][acc] Remove declare attribute verification (#137676)
The part that verifies the declare attributes are preserved in the
verifier can fail easily during the FIR lowering pipeline. For example,
during FIR lowering to FIRCG, fir.declare can be removed. Thus, any
fir.declare that has acc.declare attributes will cause a verifier
failure. Since the declare attribute only existed to simplify the effort
of locating acc declare enter and exit points, which can be easily
replaced by a def-use chain traversal, we are considering removing the
verification of declare attributes in this MR.

Example:

```  
%1 = fir.alloca !fir.array<10xf32> {bindc_name = "arr", uniq_name = "_QMmmFsubEarr"}                                                                                                                                  
%2 = fir.shape %c10 : (index) -> !fir.shape<1>
%3 = fir.declare %1(%2) {acc.declare = #acc.declare<dataClause =  acc_create>, uniq_name = "_QMmmFsubEarr"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<10xf32>>
%4 = acc.create varPtr(%3 : !fir.ref<!fir.array<10xf32>>) -> !fir.ref<!fir.array<10xf32>> {name = "arr"}
%5 = acc.declare_enter dataOperands(%4 : !fir.ref<!fir.array<10xf32>>) 
```

the acc.declare_enter itself is enough to identify when the data region
starts.
2025-04-28 13:11:26 -07:00
David Green
86b7ce9497 [CostModel] Remove some negative costs. (#135533)
The cost model in the past returned -1 for unknown costs, but over time
this has largely been removed. This cleans up some of the uses that have
remained. It uses 0/free for the cost of an insert and 1/basic for the
cost of anything that is unknown.
2025-04-28 21:08:14 +01:00
Maryam Moghadas
82a1d5078d [PowerPC] Add dense math half-precision floating-point outer-product accumulate to DMR instructions (#133272)
This patch adds the following Dense Math Facility 16-bit half-precision
floating-point calculation instructions: dmxvf16gerx2, dmxvf16gerx2pp,
dmxvf16gerx2pn, dmxvf16gerx2np, dmxvf16gerx2nn, pmdmxvf16gerx2,
pmdmxvf16gerx2pp, pmdmxvf16gerx2pn, pmdmxvf16gerx2np, pmdmxvf16gerx2nn,
along with their corresponding intrinsics and tests.
2025-04-28 16:03:10 -04:00
Sam Elliott
31bd7a5071 [RISCV] XFAIL SiFive Interrupt Test 2025-04-28 13:00:49 -07:00
ivangarcia44
cd116ee29e Add examples for reinterpret_cast and subview operators to show their behavior in relation to their input memref underlying memory and view (#135244)
While working on #134845 I was trying to understand the difference of
how the reinterpret_cast and subview operators see the input memref, but
it was not clear to me.

I did a couple of experiments in which I learned that the subview takes
into account the view of the input memref to create the view of the
output memref, while the reinterpret_cast just uses the underlying
memory of the input memref.

I thought it would help future readers to see these two experiements as
examples in the documentation to quickly figure out the difference
between these two operators.

@matthias-springer
@joker-eph
@sahas3
@Hanumanth04
@dixinzhou
@rafaelubalmw

---------

Co-authored-by: Ivan Garcia <igarcia@vdi-ah2ddp-178.dhcp.mathworks.com>
2025-04-28 15:58:47 -04:00
Joshua Batista
c8b3d79961 [DXIL] Remove incompatible metadata types when preparing DXIL. (#136386)
This PR introduces a Metadata Node Kind allowlist. The purpose is to
prevent newer Metadata Node Kinds to be used and inserted into the
outputted DXIL module. Only the metadata kinds that are accepted in the
DXIL Validator are on the allowlist. The Github DXC validator doesn't
support these newer Metadata Node Kinds, so we need to filter them out.

We introduce this restrictive allowlist into LLVM and strip all metadata
that isn't found in the list.

The accompanying test would add the `llvm.loop.mustprogress` metadata
node kind, but thanks to the allowlist, filters it out, and so the
whitelist is proven to work.
The test also has two separate metadata kinds that are on the allowlist,
and remain after the DXIL Prepare pass.
2025-04-28 12:43:38 -07:00
Jan Svoboda
cebaf0cea1 [clang] Make the AnalyzerOptions reference count non-intrusive (#137680)
This PR makes `CompilerInvocation` the sole owner of the
`AnalyzerOptions` instance. Clients can no longer become co-owners by
doing something like this:

```c++
void shareOwnership(CompilerInvocation &CI) {
  IntrusiveRefCntPtr Shared = &CI.getAnalyzerOpts();
}
```

The motivation for this is given here:
https://github.com/llvm/llvm-project/pull/133467#issuecomment-2762065443
2025-04-28 12:42:03 -07:00
Alexey Samsonov
882bae9f43 [libc][bazel] Make top section of BUILD.bazel files more uniform. (#137689)
Make sure all BUILD.bazel files under llvm-libc are specifying
package-level default_visibility and licenses.

Add top-level license notice and comment to new BUILD.bazel for
complex.h functions.
2025-04-28 12:40:24 -07:00
Nick Sarnie
f9ee5ce605 [clang][SPIR-V] Fix OpenCL addrspace mapping when using non-zero default AS (#137187)
Based on feedback from https://github.com/llvm/llvm-project/pull/136753,
remove the dummy values for OpenCL and make them match the zero default
AS map.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-04-28 19:26:01 +00:00
Peter Collingbourne
95795ab7dc Linker: Remove dropTriviallyDeadConstantArrays().
By calling this function after every link, we introduce quadratic
behavior during full LTO links that primarily affects links involving
large numbers of constant arrays, such as the full LTO part of a
ThinLTO link which will involve large numbers of vtable constants.
Removing this call resulted in a 1.3x speedup in the indexing phase
of a large internal Google binary.

This call was originally introduced to reduce memory consumption during
full LTO (see commit dab999d54f), but it
doesn't seem to be the case that this helps any more. I ran 3 stage2
links of clang with full LTO and ThinLTO with and without this change
and measured the max RSS. The results were as follows (all in KB):

```
FullLTO before 22362512 22383524 22387456
         after 22383496 22365356 22364352
ThinLTO before  4391404  4478192  4383468
         after  4399220  4363100  4417688
```

As you can see, any max RSS differences are in the noise.

Reviewers: nikic, teresajohnson

Reviewed By: teresajohnson, nikic

Pull Request: https://github.com/llvm/llvm-project/pull/137081
2025-04-28 12:23:42 -07:00
Michael Jones
9124e963a3 [libc] Update assert for C23 (#137402)
Previously the assert macro took one argument named "e", but this led to
possible errors if the caller had commas in their input. C23 changed the
definition of assert to use `__VA_ARGS__` to ensure comma cases are
handled properly. This patch doesn't introduce the enforcement function
mentioned in the standard update, though that may be done in a followup.

Fixes #136184
2025-04-28 15:06:52 -04:00
Sirish Pande
abec9ff47d [AMDGPU] Correctly merge noalias scopes during lowering of LDS data. (#131664)
Currently, if there is already noalias metadata present on loads and
stores, lower module lds pass is generating a more conservative aliasing
set. This results in inhibiting scheduling intrinsics that would have
otherwise generated a better pipelined instruction.

The fix is not to always intersect already existing noalias metadata
with noalias created for lowering of LDS. But to intersect only if
noalias scopes are from the same domain, otherwise concatenate exising
noalias sets with LDS noalias.

There a few patches that have come for scopedAA in the past. Following
three should be enough background information.
https://reviews.llvm.org/D91576
https://reviews.llvm.org/D108315
https://reviews.llvm.org/D110049

Essentially, after a pass that might change aliasing info, one should
check if that pass results in change number of MayAlias or ModRef using
the following:
`opt -S -aa-pipeline=basic-aa,scoped-noalias-aa -passes=aa-eval
-evaluate-aa-metadata -print-all-alias-modref-info -disable-output`
2025-04-28 14:02:18 -05:00
Florian Hahn
043b04acff Reapply "[VPlan] Fold NOT into predicate of wide compares." (#130347)
This reverts commit 8dd160f476.

The recommit contains an adjustment to planContainsAdditionalSimplifications,
which considers changes to the original predicate for compares.

Original commit message:

Add simplification to fold negation into a compare, if the negation is
the only user of the compare. This removes a number of redundant
negations.

Alive2 Proofs for FPCMP test changes:  https://alive2.llvm.org/ce/z/WGDz9U

PR: https://github.com/llvm/llvm-project/pull/129430
2025-04-28 20:01:37 +01:00
Douglas
efd46bc1ef [sanitizer] Allow use-after-scope front-end argument to take effect with -fsanitize=kernel-address (#137015)
Allow `-f[no]-sanitize-address-use-after-scope` to take effect under
kernel-address sanitizer (`-fsanitize=kernel-address`). `use-after-scope` is
now enabled by default under kernel-address sanitizer.

Previously, users may have enabled `use-after-scope` checks for kernel-address
sanitizer via `-mllvm -asan-use-after-scope=true`. While this may have worked
for optimization levels > O0, the required lifetime intrinsics to allow for
`use-after-scope` detection were not emitted under O0. This commit ensures
the required lifetime intrinsics are emitted under O0 with kernel-address
sanitizer.
2025-04-28 11:54:43 -07:00
Florian Mayer
6d7edbb59d Revert "[CodeGen] Use OwningArrayRef in NodeMetadata (NFC)" (#137684)
Reverts llvm/llvm-project#137539

This breaks the MSan buildbot. Please either fix the build or merge this
revert.
2025-04-28 11:45:21 -07:00
Jonas Devlieghere
9d77a3fa1a [debugserver] Remove PThreadMutex (NFC) (#137555)
Now that all uses of PThreadMutex have been migrated to their C++
equivalent, this PR removes PThreadMutex itself.
2025-04-28 11:28:45 -07:00
Snehasish Kumar
a61048bbcd [MemProf][NFC] Hoist size computation out of the loop for v3 (#137479)
Similar to the suggestion in #137394. In this case apply it to the current binary format (v3).
2025-04-28 11:16:29 -07:00
David Rivera
45411ac895 [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (#134774)
**Edit:**
I suggest we avoid diagnosing initializers for `std::array` type. The
fixit provided is incorrect as observed in **#133715.** The only
workaround would require C99-style array designators which don’t really
align with the purpose of this check. This would also generate extra
compiler warnings.

Fixes #133715
2025-04-28 20:12:38 +02:00
Sarah Spall
561a21f18c [HLSL] Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and 'max' in own files (#137004)
Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and
'max' in own files which guarantee hlsl version 202x.
Closes #133277
2025-04-28 11:02:11 -07:00
Jonas Devlieghere
64737ceb9a [lldb-dap] Bump the version to 0.2.12 2025-04-28 10:33:22 -07:00
Jonas Devlieghere
46fd2b94af [debugserver] Migrate PThreadEvent away from PThreadMutex (NFC) (#137554)
The debugserver code predates modern C++, but with C++11 and later
there's no need to have something like PThreadMutex. This migrates
PThreadEvent away from PThreadMutex in preparation for removing it.
2025-04-28 10:31:59 -07:00
Krzysztof Pszeniczny
acaf403c63 [SampleProfile] Fix UB in Demangler invocation. (#137659)
Currently the backing buffer of a `std::vector<char>` is passed[1] to
`Demangler.getFunctionBaseName`. However, deeply inside the call stack
`OutputBuffer::grow` will call[2] `std::realloc` if it needs to grow the
buffer, leading to UB.

The demangler APIs specify[3] that "`Buf` and `N` behave like the second
and third parameters to `__cxa_demangle`" and the docs for the latter
say[4] that the output buffer must be allocated with `malloc` (but can
also be `NULL` and will then be realloced accordingly).

Note: PR #135863 changed this from a stack array to a `std::vector` and
increased the size to 65K, but this can still lead to a crash if the
demangled name is longer than that - yes, I'm surprised that a >65K-long
function name happens in practice...

[1]:
d7e631c7cd/llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp (L744)
[2]:
d7e631c7cd/llvm/include/llvm/Demangle/Utility.h (L50)
[3]:
d7e631c7cd/llvm/include/llvm/Demangle/Demangle.h (L92-L93)
[4]:
https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/a01696.html
2025-04-28 19:28:56 +02:00
Med Ismail Bennani
4e4c6d7e27 [lldb/Format] Make progress count show thousands separators (NFC) (#137446)
This patch changes the progress count formatting show thousands
separator making it easier to read big numbers.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-04-28 10:26:40 -07:00
Vy Nguyen
0c57f89752 [lld-macho]Added missing commit from PR/135241 (#137672) 2025-04-28 13:24:05 -04:00
Vy Nguyen
c5f61908a7 [lld-macho]Fix bug in finding "chained" re-exported libs. (#135241)
Details:
When we have the following scenario:

- lib_a re-exports lib_b
- lib_b re-exports @rpath/lib_c
  + lib_b contains LC_RPATH

Previously, lld-macho cannot find lib_c because it was attempting to
resolve the '@rpath' from lib_b (which had no LC_RPATH defined). The
change here is to also consider all the LC_RPATH rom lib_b when trying
to find lib_c.

Inspired by real-life example when linking with
libXCTestSwiftSupport.dylib (which re-exports XCTest, which re-exports
XCTestCore)
2025-04-28 13:16:07 -04:00
Amr Hesham
e44f7760fa [CIR][NFC] Fix an unused variable warning (#137466)
This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.
2025-04-28 19:06:20 +02:00
weiguozhi
b25b51eb63 [InlineSpiller] Check rematerialization before folding operand (#134015)
Current implementation tries to fold the operand before
rematerialization because it can reduce one register usage. But if there
is a physical register available we can still rematerialize it without
causing high register pressure.

This patch do this check to find the better choice. Then we can produce

    xorps %xmm1, %xmm1
    ucomiss %xmm1, %xmm0

instead of 

    ucomiss LCPI0_1(%rip), %xmm0
2025-04-28 09:52:03 -07:00
Mark de Wever
2b57ebb50b [libc++][CI] Improves updating Docker image. (#134497)
This makes it easier to build a new Docker image in the CI. Since the
new image is not used automatically it's safe to commit these changes
directly to main. Then use a PR to test the new image.
2025-04-28 18:51:32 +02:00
Jonas Devlieghere
9f2bcc7a66 [debugserver] Migrate DNBTimer away from PThreadMutex (NFC) (#137540)
The debugserver code predates modern C++, but with C++11 and later
there's no need to have something like PThreadMutex. This migrates
DNBTimer away from that class in preparation for removing PThreadMutex.
2025-04-28 09:44:14 -07:00
Kazu Hirata
044ff78adc [TableGen] Simplify a string comparison (NFC) (#137584) 2025-04-28 09:34:27 -07:00
Kazu Hirata
0d56799457 [SPIRV] Use the range constructor of SmallPtrSet (NFC) (#137583) 2025-04-28 09:33:59 -07:00
Craig Topper
ca21508080 [Targets] Migrate from atomic_load_8/16/32/64 to atomic_load_nonext_8/16/32/64. NFC (#137428)
This makes them more consistent with the checks performed by regular loads. We can't simply add IsNonExtLoad to the existing atomic_load_8/16/32/64 as that would affect out of tree targets.
2025-04-28 09:26:34 -07:00
Victor Lomuller
76d83e6250 [SPIRV] Correctly map OpGenericCastToPtrExplicit builtins (#137189)
The __spirv_GenericCastToPtrExplicit_To* builtins and its equivalent
OpenCL builtins (to_global, to_local and to_private) were mapped to
OpGenericCastToPtr instead of OpGenericCastToPtrExplicit.

The patch now uses OpGenericCastToPtrExplicit for these builtins.
2025-04-28 18:05:24 +02:00
Victor Lomuller
0cd20537c6 [SPIRV] Stop unconditionally emitting SPV_INTEL_arbitrary_precision_integers when allowed (#137167)
When the SPV_INTEL_arbitrary_precision_integers extension is allowed to
be used, the backend will unconditionnally add it to the module used
extensions.

The patch prevent SPV_INTEL_arbitrary_precision_integers from being
declared if unneeded.
2025-04-28 18:05:06 +02:00
Jonathan Thackray
7ee0097b48 Revert "[llvm] Add support for llvm IR atomicrmw fminimum/fmaximum instructions" (#137657)
Reverts llvm/llvm-project#136759 due to bad interaction with c792b25e4
2025-04-28 16:53:36 +01:00
Oliver Hunt
ac40bc7d5f Revert "[clang] Remove FEM_Indeterminable" (#137654)
Reverts llvm/llvm-project#137247
2025-04-28 08:50:48 -07:00