533385 Commits

Author SHA1 Message Date
Julian Lettner
4b90f24db8
[LLDB] Add integration test for libsanitizers trace collection (#134323)
Add integration test for libsanitizers trace collection
(`SanitizersAllocationTraces=all`).
    
rdar://144244084
2025-04-07 08:33:27 -07:00
Joseph Huber
e2885772f0 [libc] Fix function that wasn't updated in wrapper headers 2025-04-07 10:30:58 -05:00
Matheus Izvekov
954ccee5d5
[clang] fix partial ordering of NTTP packs (#134461)
This fixes partial ordering of pack expansions of NTTPs, by procedding
with the check using the pattern of the NTTP through the rules of the
non-pack case.

This also unifies almost all of the different versions of
FinishTemplateArgumentDeduction (except the function template case).
This makes sure they all follow the rules consistently, instantiating
the parameters and comparing those with the argument.

Fixes #132562
2025-04-07 12:30:51 -03:00
Michael Klemm
7fa388d77b
[Flang][OpenMP] Fix bug with default(none) and host-assoc threadprivate variable (#134122)
When a host associated `threadprivate` variable was used in a parallel
region with `default(none)` in an internal subroutine was failing,
because the compiler did not properly determine that the variable was
pre-determined `threadprivate` and thus should not have been reported as
missing a DSA.
2025-04-07 17:20:17 +02:00
Justin Bogner
48bad5bbcd
[HLSL] Include SPIRV in LLVM_TARGETS_TO_BUILD in the HLSL cmake cache (#133287)
Since SPIRV is no longer an experimental target this wasn't actually
enabling it any more.
2025-04-08 00:07:15 +09:00
Matt Arsenault
28a391848c Bitcode: Convert test to opaque pointers 2025-04-07 21:59:11 +07:00
zhijian lin
8fddef8483
[SelectionDAG] Introducing a new ISD::POISON SDNode to represent the poison value in the IR. (#125883)
A new ISD::POISON SDNode is introduced to represent the `poison value`
in the IR, replacing the previous use of ISD::UNDEF.
2025-04-07 10:03:05 -04:00
Farzon Lotfi
82103dfae9
Revert "Reland [Clang][Cmake] fix libtool duplicate member name warnings" (#134656)
Reverts llvm/llvm-project#133850
2025-04-07 10:00:53 -04:00
Igor Wodiany
cff65657d9
[mlir][spirv] Fix incorrect argument erasure in deserializer (#134610)
The current implementation iterates and modifies the list of arguments
at the same time. Depending on the number of arguments this will trigger
an assert: `assert(index < arguments.size())`. This change replaces loop
with a range based erasure.
2025-04-07 15:00:33 +01:00
Farzon Lotfi
0d71d9ab28
Reland [Clang][Cmake] fix libtool duplicate member name warnings (#133850)
fixes https://github.com/llvm/llvm-project/issues/133199

As of the third commit the fix to the linker missing references in
`Targets/DirectX.cpp` found in
https://github.com/llvm/llvm-project/pull/133776 was fixed by moving
`HLSLBufferLayoutBuilder.cpp` to `clang/lib/CodeGen/Targets/`.

It fixes the circular reference issue found in
https://github.com/llvm/llvm-project/pull/133619 for all
`-DBUILD_SHARED_LIBS=ON` builds by removing `target_link_libraries` from
the sub directory cmake files.

testing for amdgpu offload was done via
`cmake -B ../llvm_amdgpu -S llvm -GNinja -C
offload/cmake/caches/Offload.cmake -DCMAKE_BUILD_TYPE=Release`

PR https://github.com/llvm/llvm-project/pull/132252 Created a second
file that shared <TargetName>.cpp in clang/lib/CodeGen/CMakeLists.txt

For example There were two AMDGPU.cpp's one in TargetBuiltins and the
other in Targets. Even though these were in different directories
libtool warns that it might not distinguish them because they share the
same base name.

There are two potential fixes. The easy fix is to rename one of them and
keep one cmake file. That solution though doesn't future proof this
problem in the event of a third <TargetName>.cpp and it seems teams want
to just use the target name

https://github.com/llvm/llvm-project/pull/132252#issuecomment-2758178483.

The alternative fix that this PR went with is to seperate the cmake
files into their own sub directories as static libs.
2025-04-07 09:53:07 -04:00
Asher Mancinelli
b2711e1526
[flang][nfc] Support volatile on ref, box, and class types (#134386)
Part one of merging #132486. Add support for representing volatility in
the type system for reference, box, and class types. Don't do anything
with volatile just yet, only support and test their representation and
utility functions.

The naming convention is a little goofy - `fir::isa_volatile_type` and
`fir::updateTypeWithVolatility` use different capitalization, but I put
them near similar functions and tried to match the surrounding
conventions and [the
docs](https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md#naming)
best I could.
2025-04-07 06:51:02 -07:00
Pedro Lobo
0ab2061c4f
[WebAssembly] Represent trap instructions as poison (#134553)
The WebAssemblyLowerRefTypesIntPtrConv pass currently uses `undef` to
represent trap instructions. These can instead be represented by the
`poison` value.
2025-04-07 14:29:55 +01:00
Farzon Lotfi
771b94fa83
[NFC][SPIRV] remove unimplemented function define for selectCross (#134478)
- `selectCross` looks to be a function that had its implementation and
usage removed but this define some how stuck around.
- this change removes the definition.
2025-04-07 09:26:36 -04:00
Nashe Mncube
67dd2019ac
Recommit [AArch64][SVE]Use FeatureUseFixedOverScalableIfEqualCost for A510/A520 (#134606)
Recommit. This work was done by #132246 but failed buildbots due to the
test introduced needing updates

Inefficient SVE codegen occurs on at least two in-order cores, those
being Cortex-A510 and Cortex-A520. For example a simple vector add

```
void foo(float a, float b, float dst, unsigned n) {
    for (unsigned i = 0; i < n; ++i)
        dst[i] = a[i] + b[i];
}
```

Vectorizes the inner loop into the following interleaved sequence of
instructions.

```
        add     x12, x1, x10
        ld1b    { z0.b }, p0/z, [x1, x10]
        add     x13, x2, x10
        ld1b    { z1.b }, p0/z, [x2, x10]
        ldr     z2, [x12, #1, mul vl]
        ldr     z3, [x13, #1, mul vl]
        dech    x11
        add     x12, x0, x10
        fadd    z0.s, z1.s, z0.s
        fadd    z1.s, z3.s, z2.s
        st1b    { z0.b }, p0, [x0, x10]
        addvl   x10, x10, #2
        str     z1, [x12, #1, mul vl]
```

By adjusting the target features to prefer fixed over scalable if the
cost is equal we get the following vectorized loop.

```
         ldp q0, q3, [x11, #-16]
         subs    x13, x13, #8
         ldp q1, q2, [x10, #-16]
         add x10, x10, #32
         add x11, x11, #32
         fadd    v0.4s, v1.4s, v0.4s
         fadd    v1.4s, v2.4s, v3.4s
         stp q0, q1, [x12, #-16]
         add x12, x12, #32
```

Which is more efficient.
2025-04-07 14:09:43 +01:00
Krisztian Rugasi
382962b4a8 [GlobalISel] Fix dangling reference in CombinerHelper::matchCombineExtractedVectorLoad 2025-04-07 15:04:36 +02:00
Andrzej Warzyński
2f6bc47a18
[mlir][vector] Standardise valueToStore Naming Across Vector Ops (NFC) (#134206)
This change standardises the naming convention for the argument
representing the value to store in various vector operations.
Specifically, it ensures that all vector ops storing a value—whether
into memory, a tensor, or another vector — use `valueToStore` for the
corresponding argument name.

Updated operations:
* `vector.transfer_write`, `vector.insert`, `vector.scalable_insert`,
  `vector.insert_strided_slice`.

For reference, here are operations that currently use `valueToStore`:
* `vector.store` `vector.scatter`, `vector.compressstore`,
  `vector.maskedstore`.

This change is non-functional (NFC) and does not affect the
functionality of these operations.

Implements #131602
2025-04-07 13:56:54 +01:00
Matthias Springer
bafa2f4442
[mlir][memref] Check memory space before lowering alloc ops (#134427)
Check the memory space before lowering allocation ops, instead of
starting the lowering and then rolling back the pattern when the memory
space was found to be incompatible with LLVM.

Note: This is in preparation of the One-Shot Dialect Conversion
refactoring.

Note: `isConvertibleAndHasIdentityMaps` now also checks the memory
space.
2025-04-07 14:38:18 +02:00
JaydeepChauhan14
4509bc1299
[X86][GlobalISel] Enable POWI function with libcall mapping (#134369) 2025-04-07 14:32:56 +02:00
Jay Foad
e2fe78797f
[Clang] Use "syncscope" instead of "synchscope". NFC. (#134616)
This matches the spelling of the keyword in LLVM IR.
2025-04-07 13:32:36 +01:00
Christian Sigg
9fe6f6a0d4
[bazel] Change gentbl_cc_library(tbl_outs) to dicts (#134349)
Follow up from https://github.com/llvm/llvm-project/pull/134271
2025-04-07 14:23:22 +02:00
Mats Jun Larsen
4d1e4eff5f
[IR] Avoid call to deprecated PointerType::get (NFC) (#134609)
Should keep MSVC quiet as noticed by @rksimon in #134517.

Assertions have been copied over from PointerType::get in order to not
silently change invariants with this call.
2025-04-07 12:09:00 +00:00
Uday Bondhugula
37deb09593
[MLIR][Affine] Fix signatures of normalize memref utilities (#134466)
These methods were passing derived op types by pointers, which deviates
from the style. While on this, fix obsolete comments on those methods.
2025-04-07 17:36:28 +05:30
Zhaoxin Yang
bd84d66700
[lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (#123680)
Original code sequence:
* pcalau12i $a0, %ie_pc_hi20(sym)
* ld.d           $a0, $a0, %ie_pc_lo12(sym)

The code sequence converted is as follows:
* lu12i.w   $a0, %le_hi20(sym)         # le_hi20 != 0, otherwise NOP
* ori          $a0, src, %le_lo12(sym)  # le_hi20 != 0, src = $a0,
                                                         # otherwise,    src = $zero

TODO: When relaxation is enabled, redundant NOP can be removed. This
will be implemented in a future patch.
    
Note: In the normal or medium code model, original code sequence with
relocations allow interleaving, because converted code sequence
calculates the absolute offset. However, in extreme code model, to
identify the current code model, the first four instructions with
relocations must appear consecutively.
2025-04-07 19:58:48 +08:00
Jay Foad
c9280ba25a
[AMDGPU] Simplify emitAtomicRMWLegalRemark. NFC. (#134614) 2025-04-07 12:27:43 +01:00
Simon Pilgrim
6c7c8b4776 [X86] LowerINTRINSIC_WO_CHAIN - cleanup and clang-format VP2INTERSECT handling. NFC. 2025-04-07 12:23:15 +01:00
Jorn Tuyls
96de8435b9
[mlir][NVVM] Fix default label unreachable warning in getVoteSyncIntrinsicId (#134600)
Fixes the following warning after the changes in
https://github.com/llvm/llvm-project/pull/134309:

```
llvm-project/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp:134:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
  default:
  ^
1 warning generated.
```
2025-04-07 13:13:02 +02:00
Aaron Ballman
b9ec68431b
Correctly diagnose incomplete arrays with static storage in C (#134374)
A file scope declaration without an initializer which is neither extern
nor thread_local is a tentative definition. If the declaration of an
identifier for an object is a tentative definition and has internal
linkage, the declared type shall not be an incomplete type.

Clang was previously failing to diagnose this in -pedantic mode.

Fixes #50661

---------

Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
2025-04-07 07:12:33 -04:00
Tom Eccles
b9c876dd9a
[flang][test] fix sporadically failing test (#134608)
The test is checking output from MLIR debug prints. MLIR passes can be
executed in parallel, for example a pass on func.func might schedule
different func.func operations in different threads. This led to
intermittent test failures where debug output from different threads
became mixed up.

Fix by disabling mlir multithreading for this test.
2025-04-07 12:10:43 +01:00
Mel Chen
409df9f74c
[TTI][LV] Change the prototype of preferInLoopReduction. nfc (#132698)
This patch changes the preferInLoopReduction function to take a
RecurKind instead of an unsigned Opcode.
This makes it possible to distinguish non-arithmetic reductions such as
min/max, AnyOf, and FindLastIV, and also helps unify IAnyOf with FAnyOf
and IFindLastIV with FFindLastIV.

Related patch #118393 #131830
2025-04-07 19:10:16 +08:00
Anatoly Trosinenko
2c107238d5
[BOLT] Make DataflowAnalysis::getStateBefore() const (NFC) (#133308) 2025-04-07 13:37:34 +03:00
Jack Frankland
7b007c092d
[mlir][tosa-to-linalg] Add acc_type lowering Support (#134267)
Add support for lowering of convolution operations where the `acc_type`
attribute differs from the result type of the operation. The only case
of this in for convolutions in the TOSA-v1.0 specification is an fp16
convolution which internally uses an fp32 accumulator; all other
operations have accumulator types that match their output/result types.

Add lit tests for the fp16 convolution with fp32 accumulator operators
described above.

Signed-off-by: Jack Frankland <jack.frankland@arm.com>
2025-04-07 11:37:26 +01:00
Andrzej Warzyński
c9157d4692
[llvm][docs] Reorder sections in GitHub.rst (#134212)
Reorder sections in GitHub.rst so that "Branches" and "Stacked Pull
Requests" appear after the more general section on pull requests. This
improves the conceptual flow for readers new to the process:

New order:
  * Introduction
  * Before your first PR
  * Pull Requests
  * Approvals
  * Landing your change
  * Branches
  * Stacked Pull Requests
  * ...

Previous order:
  * Introduction
  * Before your first PR
  * Branches
  * Stacked Pull Requests
  * Pull Requests
  * Approvals
  * Landing your change
  * ...

This change only reorders existing text - no content edits.
2025-04-07 11:36:55 +01:00
Anatoly Trosinenko
0fc7aec349
[BOLT] Gadget scanner: detect address materialization and arithmetic (#132540)
In addition to authenticated pointers, consider the contents of a
register safe if it was
* written by PC-relative address computation
* updated by an arithmetic instruction whose input address is safe
2025-04-07 13:13:11 +03:00
Abhishek Kaushik
3654621e87
[X86][NFC] Use Triple & to avoid copy (#134532) 2025-04-07 15:38:38 +05:30
Han-Kuan Chen
5748ddbab4
[SLP] NFC. Add a comment to introduce the alternate instruction. (#134572) 2025-04-07 18:03:26 +08:00
Matthias Springer
431c8dd073
[mlir][IR] Add support for UnknownLoc to verify-diagnostics (#134421)
Diagnostics at unknown locations can now be verified with
`-verify-diagnostics`.

Example:
```
// expected-error@unknown {{something went wrong}}
```

Also clean up some MemRefToLLVM conversion tests that had to redirect
all errors to stdout in order to FileCheck them. All of those tests can
now be stored in a single `invalid.mlir`. That was not possible before.
2025-04-07 12:03:04 +02:00
Matt Arsenault
65c7ea713e
SLPVectorizer: Avoid looking at uselists of constants (#134578) 2025-04-07 16:52:11 +07:00
Simon Pilgrim
ec400277c6 Fix MSVC "not all control paths return a value" warning. NFCI. 2025-04-07 10:31:38 +01:00
Simon Pilgrim
679b2f714a Fix MSVC "not all control paths return a value" warning. NFCI. 2025-04-07 10:30:59 +01:00
Simon Pilgrim
387a8859cf Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFCI. 2025-04-07 10:29:16 +01:00
Luke Lau
be6ccc98f3
[VPlan] Split out VPBlendRecipe simplifications from simplifyRecipes. NFC (#134073)
This is split off from #133977

VPBlendRecipe normalisation is sensitive to the number of users a mask
has, so should probably be run after the masks are simplified as much as
possible.

Note this could be run after removeDeadRecipes but this causes test
diffs, some regressions, so this is left to a later patch.
2025-04-07 09:55:52 +01:00
Mike
f20cb3f8d2
[mlir][bufferization] Drop the assumption for alloc result index (#134503)
Relax the assumption that alloc op always has allocation at
`getResult(0)`, allow to use `optimize-allocation-liveness` pass for
custom ops with >1 results. Ops with multiple allocations are not
handled here yet.
2025-04-07 11:54:44 +03:00
Juan Manuel Martinez Caamaño
44e32fb802
[Clang][OpenCL] Fix wait_for_event argument address space with -fdeclare-opencl-builtins (#134598)
The pointer argument for `wait_for_event(int, event_t*)` should take the
default address space: generic if available, otherwise private.

Before this patch it would always be generic with
`-fdeclare-opencl-builtins`. This was inconsistent with the behavior
when opencl-c.h is included.
2025-04-07 10:44:37 +02:00
Matt Arsenault
4a425a4966
NaryReassociate: Check pattern before user scan (#134587) 2025-04-07 15:25:03 +07:00
Matt Arsenault
04bb8ecb05
AMDGPU: Disable sincos fold for constant inputs (#134579) 2025-04-07 15:20:23 +07:00
Robert Imschweiler
2f8b486f97
[IR][JumpThreading] Fix infinite recursion on compare self-reference (#129501)
In unreachable code, constant PHI nodes may appear and be replaced by their
single value. As a result, instructions may become self-referencing. This
commit adds checks to avoid going into infinite recursion when handling
self-referencing compare instructions in `evaluateOnPredecessorEdge()`.

This LLVM defect was identified via the AMD Fuzzing project.
2025-04-07 10:01:36 +02:00
Matt Arsenault
4a5ff3ec21
Value: Remove redundant removeFromList in dropDroppableUse (#134580) 2025-04-07 15:00:41 +07:00
Matt Arsenault
7b3b4a5b1b
IR: Use poison in dropDroppableUse (#134576) 2025-04-07 14:59:34 +07:00
Balázs Kéri
31ef7acf12
[clang][analyzer] Fix a possible crash in CastSizeChecker (#134387) 2025-04-07 09:46:03 +02:00
Nikita Popov
87a4215ed1
[Clang] Always verify LLVM IR inputs (#134396)
We get a lot of issues that basically boil down to "I passed malformed
LLVM IR to clang and it crashed". Clang does not perform IR verification
by default in (non-assertion-enabled) release builds, and that's
sensible for IR that Clang itself produces, which is expected to always
be valid. However, if people pass in their own handwritten IR, we should
report if it is malformed, instead of crashing. We should also report it
in a way that does not produce a crash trace and ask for a bug report,
as currently happens in assertions-enabled builds. This aligns the
behavior with how opt/llc work.
2025-04-07 09:18:47 +02:00