547939 Commits

Author SHA1 Message Date
Fangrui Song
f9b68838f6
ELF: -r: Call assignAddresses only once
The fixed-point layout algorithm handles linker scripts, thunks, and
relaxOnce (to suppress out-of-range GOT-indirect-to-PC-relative
optimization). These passes are not needed for relocatable links because
they require address information that is not yet available.

Since we don't scan relocations for relocatable links, the
`createThunks` and `relaxOnce` functions are no-ops anyway, making these
passes redundant.

To prevent cluttering the line history, I place the `if (...) break;`
inside the for loop.

Pull Request: https://github.com/llvm/llvm-project/pull/152240
2025-08-07 08:31:27 -07:00
James Newling
0cb98c721b
[mlir][vector] Replace vector.splat with vector.broadcast in some tests (#152230)
Splat is deprecated, and being prepared for removal in a future release.

https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143/5

The command I used, catches almost every splat op: 
 ```
perl -i -pe
's/vector\.splat\s+(\S+)\s*:\s*vector<((?:\[?\d+\]?x)*)\s*([^>]+)>/vector.broadcast
$1 : $3 to vector<$2$3>/g' filename
 ```
2025-08-07 08:28:04 -07:00
Erick Ochoa Lopez
44fbeb3215
[mlir][vector] Use llvm::Align when constructing vector load and stores. (#152207)
This patchset uses `llvm::Align` when constructing `vector.{load,store}`
operations. The use of `llvm::Align` allows us to specify the unit of
alignment and strongly type alignment as opposed to having just unsigned
integers.
2025-08-07 11:12:16 -04:00
Timm Baeder
3b5cc2dc63
[clang][bytecode][NFC] Refactor DynamicAllocator a bit (#152510)
Use empty()-style functions instead of exposing the size if we don't
need it.
2025-08-07 17:03:53 +02:00
Davide Grohmann
3fa34f17e8
[mlir][spirv] Add mlir-spirv-tests CI to run for mlir-spv target tests (#152124)
This should execute also the MLIR SPIRV Target tests which require the
SPIRV-Tools validator

---------

Signed-off-by: Davide Grohmann <davide.grohmann@arm.com>
2025-08-07 10:51:32 -04:00
Caslyn Tonelli
e1171e6a98
[libc][dlfcn] Remove unused errno dep (#152222)
This removes the errno dep for the stub libdl functions, since there is
no need for it.
2025-08-07 07:48:28 -07:00
Csanád Hajdú
c088b5ffca
[compiler-rt][AArch64] Add GCS property in assembly files (#152502)
Only BTI and PAC properties were added previously.

Fixes https://github.com/llvm/llvm-project/issues/152427.
2025-08-07 16:40:36 +02:00
Mikhail R. Gadelha
f3db0cb4d8
Reland "[RISCV] Refactor X60 scheduling model helper classes. NFC." (#152336)
This PR fixes the issue that caused an ub in PR #151472.

The issue was a shl call taking a negative shift amount (posDiff). The
result was never used, but tablegen would perform the calculation
anyway. The fix was to replace the shl call with just multiplications
with constants.

Original PR description:

This patch improves the helper classes in the SpacemiT-X60 vector
scheduling model and will be used in follow-up PRs:

There are now two functions to map LMUL to values:
* ConstValueUntilLMULThenDoubleBase: returns BaseValue for LMUL values
before startLMUL, Value for startLMUL, then doubles Value for each
subsequent LMUL. Useful for cases where fractional LMULs have constant
cycles, and integer LMULs double as they increase.
* GetLMULValue: takes an ordered list of LMUL cycles and LMUL and
returns the corresponding cycle. Useful for cases we can't easily cover
with ConstValueUntilLMULThenDoubleBase.

This PR also adds some useful simplified versions of
ConstValueUntilLMULThenDoubleBase, e.g.: ConstValueUntilLMULThenDouble
(when BaseValue == Value), or ConstOneUntilMF4ThenDouble (when cycles
start to double after MF2)
2025-08-07 11:27:46 -03:00
Kazu Hirata
82f5bd68d0
[Sema] Remove an unnecessary cast (NFC) (#152440)
getScopeRep already returns NestedNameSpecifier *.
2025-08-07 07:24:18 -07:00
Kazu Hirata
e10fdb989b
[llvm] Proofread MergeFunctions.rst (#152444) 2025-08-07 07:23:06 -07:00
Kazu Hirata
ebaaf4d2fb
[llvm-objdump] Remove unnecessary casts (NFC) (#152443)
data() alaready returns const char *.
2025-08-07 07:22:58 -07:00
Kazu Hirata
02fbb6a290
[Support] Remove an unnecessary cast (NFC) (#152442)
pattern is already of const char *.
2025-08-07 07:22:50 -07:00
Kazu Hirata
4be22dabc5
[CodeGen] Remove an unnecessary cast (NFC) (#152441)
getActiveBits() already returns unsigned.
2025-08-07 07:22:42 -07:00
Kazu Hirata
5dff1ad3a3
[ADT] Use a range-based for loop in DenseMap.h (NFC) (#152438)
This patch teaches moveFromOldBuckets to take an iterator_range so
that it can use a range-based for loop.
2025-08-07 07:22:29 -07:00
Boyana Norris
69d0bd56ad
[mlir][cmake] Fix MLIR shared library installation (#152195)
When `LLVM_INSTALL_TOOLCHAIN_ONLY=ON`, the MLIR shared library
(`libMLIR*`) is not installed even though it is built with the
`INSTALL_WITH_TOOLCHAIN` argument to the `add_mlir_library` cmake
function. This patch ensures that `libMLIR*` is installed when
`LLVM_INSTALL_TOOLCHAIN_ONLY=ON`.

Patch verified
[here](https://github.com/llvm/llvm-project/issues/151247#issuecomment-3156387055).

fixes #151247
2025-08-07 07:54:30 -06:00
Alexey Bataev
0bcf45ea34
[SLP]Initial FMAD support (#149102)
Added initial check for potential fmad conversion in reductions and
operands vectorization.
2025-08-07 09:51:43 -04:00
Michael Buch
fac7453d2c
[lldb][Mangled] Move SuffixRange computation into TrackingOutputBuffer (#152483)
This way all the tracking is self-contained in `TrackingOutputBuffer`
and we can test the `SuffixRange` properly.
2025-08-07 14:39:52 +01:00
Ross Brunton
900d20d0dc
[NFC][Offload] Move conformance test warning outside of function (#152466)
`add_conformance_test` checks for libc and prints a warning if it is not
found. However, this warning ends up being printed once for each test,
spamming the cmake log. Moving it up to the folder cmake allows it to
be reported only once.
2025-08-07 08:14:26 -05:00
Krzysztof Parzyszek
e368b5343d
[flang][OpenMP] Make OpenMPCriticalConstruct follow block structure (#152007)
This allows not having the END CRITICAL directive in certain situations.
Update semantic checks and symbol resolution.
2025-08-07 08:10:25 -05:00
Aiden Grossman
cfa00d4daf
[CI] Add --succinct to lit args (#152335)
We currently log every single test that we run in premerge. This leads
to gigantic logs (200k+ lines on Linux) that can be difficult to parse
through. Having an indicator of progress is nice, especially for the
LLVM tests, but is not strictly necessary and not often used (I
imagine). Having a progress indicator from lit that works in CI cases is
on my TODO list.

For the rare cases where someone does need to see the list of tests that
run, the JUnit XML emitted by lit is available in the artifacts.
2025-08-07 06:01:29 -07:00
Pedro Lobo
f3bf8e0166
[clang][x86] Add C/C++ and 32/64-bit test coverage to constexpr tests (#152478)
Adds missing C++ run lines to test files containing `constexpr` tests.
Also adds missing 32/64-bit test coverage to the following tests:
- `clang/test/CodeGen/X86/avx512-reduceIntrin.c`
- `clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c`
- `clang/test/CodeGen/X86/avx512vpopcntdq-builtins.c`
- `clang/test/CodeGen/X86/avx512vpopcntdqvl-builtins.c`

Additionally, fixes a `_mm512_popcnt_epi64` `constexpr` test that
incorrectly assumed 32-bit integers, leading to incorrect bit counts.
This change updates the test result to assume 64-bit integers.
2025-08-07 13:50:52 +01:00
Nikita Popov
dbfc3ed690
[TypeSanitizer] Use alloca size for lifetime markers (#152154)
Split out from https://github.com/llvm/llvm-project/pull/150248:

Use the size of the alloca instead of the size passed to the lifetime
intrinsic.

As a bonus, this handles dynamic allocas correctly (see the added test)
instead of doing a memset with size -1...
2025-08-07 14:39:32 +02:00
David Truby
f73a3028c2
[flang-rt] Use correct flang-rt build for flang-rt unit tests on Windows (#152318)
Currrently flang-rt assumes that LLVM was always built with the dynamic
MSVC runtime. This may not be the case, if the user has specified a
different runtime with -DCMAKE_MSVC_RUNTIME_LIBRARY. Since this flag is
implied by -DLLVM_ENABLE_RPMALLOC=On, which is used by the Windows
release script, this is causing that script to fail.

Fixes #151920
2025-08-07 13:09:35 +01:00
Javed Absar
ceda56be7f
[mlir][linalg] Morphism across linalg -- named, category and generic ops. (#148424)
Adds `linalg-morph-ops` pass to convert an op from one representation to another: 
   named-op <--> category_op (elementwise, contraction, ..) <--> generic
e.g.
```mlir
  %exp = linalg.exp ins(%A : tensor<16x8xf32>) outs(%B :  tensor<16x8xf32>) -> tensor<16x8xf32>
```
After `mlir-opt -linalg-morph-ops=named-to-category ..`

```mlir
  %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<16x8xf32> ..

Note: this is generalization of 
`--linalg-generalize-named-ops` is the path `named-op --> generic-op`
`--linalg-specialize-generic-ops` is the path `named-op <-- generic-op`

email: quic_mabsar@quicinc.com
2025-08-07 12:36:47 +01:00
Simon Pilgrim
f24c50a635 [X86] avx512dq-builtins.c - add C/C++ and 32/64-bit test coverage
Inspired by #152478
2025-08-07 12:08:48 +01:00
Ramkumar Ramachandra
edeee824f0
Reland [VectorUtils] Trivially vectorize ldexp, [l]lround (#152476)
Changes: The original patch, landed as 1336675, was reverted due to a
bug in LoopVectorize resulting in a crash. The bug has now been fixed by
95c32bf ([VPlan] Return invalid cost if any skeleton block has invalid
costs), and this reland is identical to the original patch.
2025-08-07 12:07:29 +01:00
Abhilash Majumder
fee6e539d0
[NVPTX] Add prefetch tensormap variant (#146203)
[NVPTX] Add Prefetch tensormap intrinsics
This PR adds prefetch intrinsics with the relevant tensormap_space.

* Lit tests are added as part of prefetch.ll
* The generated PTX is verified with a 12.3 ptxas executable.
* Added docs for these intrinsics in NVPTXUsage.rst.

For more information, refer to the PTX ISA for prefetch intrinsic :
[Prefetch
Tensormap](https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-prefetch-prefetchu)

 @durga4github @schwarzschild-radius
2025-08-07 16:19:21 +05:30
Timm Baeder
4784585747
[clang][bytecode][NFC] Remove unnecessary local variable (#152468)
Desc is only used once and we can get that information from the Block as
well.
2025-08-07 12:39:32 +02:00
Naveen Seth Hanig
474bbc1783
[Support] Enable CRTP for GraphWriter (NFC) (#152322)
Previously, specializing the GraphWriter class required a full class
specialization.
This change introduces CRTP for GraphWriter, allowing for partial
specialization.

This change is in support of printing the module dependency graph as
part of the RFC for driver-managed module builds, for which we want to
print the graph nodes in a more human-readable format by:
- Printing descriptive IDs instead of pointer addresses as node labels.
- Printing the full node labels separately from the node relations to
avoid clutter.

With this approach, only GraphWriter::writeNodes() needs to be
specialized (, aside from DOTGraphTraits).

RFC for driver-managed module builds:
https://discourse.llvm.org/t/rfc-modules-support-simple-c-20-modules-use-from-the-clang-driver-without-a-build-system
2025-08-07 12:36:45 +02:00
Yi-Chi Lee
e1d6753006
[Headers][X86] Update AVX/AVX512 float/double add/sub/mul/div/unpck intrinsics to be used in constexpr (#152435)
Fixed #152313

---------

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-08-07 11:21:58 +01:00
David Spickett
246990dc02 [llvm][MC][test] Disable many-instructons.s on 32-bit systems
Added by https://github.com/llvm/llvm-project/pull/150846.

Checks the size of a structure, which is only correct for 64-bit
systems.
2025-08-07 10:09:04 +00:00
Yanzuo Liu
109040acec
[Clang][NFC] Enumerate Clang ABI versions in a separate header file (#151995)
Make it easier for us to add ABI versions.

Close #144332
2025-08-07 18:00:43 +08:00
Donát Nagy
46a8c09489
[NFC][analyzer] Conversion to CheckerFamily: RetainCountChecker (#152138)
This commit converts RetainCountChecker to the new checker family
framework that was introduced in the commit
6833076a5d9f5719539a24e900037da5a3979289

This commit also performs some minor cleanup around the parts that had
to be changed, but lots of technical debt still remains in this old
codebase.
2025-08-07 11:59:45 +02:00
Florian Hahn
47944d071f
[LV] Auto-generate checks for sve-low-trip-count.ll.
Auto-generate checks for
https://github.com/llvm/llvm-project/pull/151925. Also update some
naming to make more consistent with other tests.
2025-08-07 10:50:20 +01:00
Pedro Lobo
5805e88745
[Headers][X86] Allow AVX512 reduction intrinsics to be used in constexpr (#152363)
Closes #152324.
Part of #30794.

This PR adds `constexpr` support for the following AVX512 integer
reduction intrinsics:

- `_mm512_reduce_add_epi32`
- `_mm512_reduce_add_epi64`
- `_mm512_reduce_mul_epi32`
- `_mm512_reduce_mul_epi64`
- `_mm512_reduce_and_epi32`
- `_mm512_reduce_and_epi64`
- `_mm512_reduce_or_epi32`
- `_mm512_reduce_or_epi64`
- `_mm512_reduce_max_epi32`
- `_mm512_reduce_max_epi64`
- `_mm512_reduce_min_epi32`
- `_mm512_reduce_min_epi64`
- `_mm512_reduce_max_epu32`
- `_mm512_reduce_max_epu64`
- `_mm512_reduce_min_epu32`
- `_mm512_reduce_min_epu64`

---------

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-08-07 10:46:22 +01:00
Florian Hahn
95c32bf2d4
[VPlan] Return invalid cost if any skeleton block has invalid costs. (#151940)
We need to reject plans that contain recipes with invalid costs. LICM
can move recipes with invalid costs out of the loop region, which then
get missed by the main cost computation.

Extend the logic to check recipes for invalid cost currently only
covering the middle block to include all skeleton blocks.

Fixes https://github.com/llvm/llvm-project/issues/144358 
Fixes https://github.com/llvm/llvm-project/issues/151664

PR: https://github.com/llvm/llvm-project/pull/151940
2025-08-07 10:45:27 +01:00
Michael Kruse
04196ba01a
[DA][NFC] clang-format DependenceAnalysis (#151505)
To avoid noise in PRs such as in #146383.
2025-08-07 11:44:25 +02:00
Ricardo Jesus
565f707beb
[AArch64] Allow splitting bitmasks for EOR/ORR. (#150394)
This patch extends #149095 for EOR and ORR.

It uses a simple partition scheme to try to find two suitable disjoint
bitmasks that can be used with EOR/ORR to reconstruct the original mask.

Fixes: #148987.
2025-08-07 10:42:30 +01:00
Ayke
aeeb9b5077
[AVR] Fix codegen after getConstant assertions got enabled (#152269)
This fixes https://github.com/llvm/llvm-project/issues/152097

This commit fixes two instances of a (somewhat) recently enabled
assertion. One with a test, the other I can't reproduce (might be dead
code) but certainly looks like an instance of the same problem.

The PR that introduced the regression:
https://github.com/llvm/llvm-project/pull/117558

With this patch, the AVR backend is usable again for TinyGo.
2025-08-07 11:40:33 +02:00
David Spickett
6cd6de5bc0
[llvm][cmake] Remove version number from runtimes in PROJECTS warnings (#152457)
Judging from the reaction to
https://github.com/llvm/llvm-project/pull/152302, we are not ready to
make this a fatal error.

Remove the specific version number, and update the libc message to match
the others' wording.
2025-08-07 10:34:01 +01:00
Timm Baeder
c869ef6ebc
[clang][bytecode] Refactor Check* functions (#152300)
... so we don't have to create Pointer instances when we don't need
them.
2025-08-07 11:32:39 +02:00
Ross Brunton
a44532544b
[Offload] Don't create events for empty queues (#152304)
Add a device function to check if a device queue is empty. If liboffload
tries to create an event for an empty queue, we create an "empty" event
that is already complete.

This allows `olCreateEvent`, `olSyncEvent` and `olWaitEvent` to run
quickly for empty queues.
2025-08-07 10:16:33 +01:00
Ties Stuij
b9e133d5b6
[AArch64][SVE] Use FeatureUseFixedOverScalableIfEqualCost for A320 (#152156)
With this new A320 in-order core, we follow adding the
FeatureUseFixedOverScalableIfEqualCost feature to A510 and A520
(#132246), which reaps the same code generation benefits of preferring
fixed over scalable when the cost is equal.

So when we have:
```
void foo(float* a, float* b, float* dst, unsigned n) {
    for (unsigned i = 0; i < n; ++i)
        dst[i] = a[i] + b[i];
}
```

When compiling without the feature enabled, we get:
```
...
    ld1b    { z0.b }, p0/z, [x0, x10]
    ld1b    { z2.b }, p0/z, [x1, x10]
    add     x12, x0, x10
    ldr     z1, [x12, #1, mul vl]
    add     x12, x1, x10
    ldr     z3, [x12, #1, mul vl]
    fadd    z0.s, z2.s, z0.s
    add     x12, x2, x10
    fadd    z1.s, z3.s, z1.s
    dech    x11
    st1b    { z0.b }, p0, [x2, x10]
    incb    x10, all, mul #2
    str     z1, [x12, #1, mul vl]
...
```

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

...
```
2025-08-07 09:48:09 +01:00
Wenju He
d618c36cb7
[libclc] Add missing clc/lib/ptx-nvidiacl/SOURCES to CMAKE_CONFIGURE_DEPENDS (#152431) 2025-08-07 16:42:13 +08:00
Anatoly Trosinenko
4da745a0f4
[BOLT] Fix unit test failures with LLVM_LINK_LLVM_DYLIB=ON (#152190)
When LLVM_LINK_LLVM_DYLIB is ON, `check-bolt` target reports unit test
failures:

    BOLT-Unit :: Core/./CoreTests/failed_to_discover_tests_from_gtest
    BOLT-Unit :: Profile/./ProfileTests/failed_to_discover_tests_from_gtest

The reason is that when llvm-lit runs a unit-test executable:

    /path/to/CoreTests --gtest_list_tests '--gtest_filter=-*DISABLED_*'

an assertion is triggered with the following message:

    LLVM ERROR: Option 'default' already exists!

This assertion triggers when the initializer of defaultListDAGScheduler
defined at SelectionDAGISel.cpp:219 is called as a statically-linked
function after already being called during the initialization of
libLLVM.

The issue can be traced down to LLVMTestingSupport library which depends
on libLLVM as neither COMPONENT_LIB nor DISABLE_LLVM_LINK_LLVM_DYLIB is
specified in a call to `add_llvm_library(LLVMTestingSupport ...)`.

Specifying DISABLE_LLVM_LINK_LLVM_DYLIB for LLVMTestingSupport makes
Clang unit test fail and COMPONENT_LIB is probably inappropriate for a
testing-specific library, thus as a workaround, added Error.cpp source
from LLVMTestingSupport directly to the list of source files of
CoreTests target (as it depends on
`llvm::detail::TakeError(llvm::Error)`) and removed LLVMTestingSupport
from the list of dependencies of ProfileTests.
2025-08-07 11:27:15 +03:00
Chaitanya Koparkar
6ce68d3a12
[DAG] canCreateUndefOrPoison - add FP_EXTEND (#152249)
Fixes https://github.com/llvm/llvm-project/issues/152141
2025-08-07 09:23:46 +01:00
LLVM GN Syncbot
0b3ee20939 [gn build] Port 6897ca460e6e 2025-08-07 07:29:48 +00:00
Matt Arsenault
7402cd6ded AMDGPU: Disable AGPR selection in mfma rewrite test
This makes the test actually test the intended rewrite
pass. Also add some tests with inline immediates in src2.
Switch the target to gfx942 for future test functions.
2025-08-07 16:28:19 +09:00
Nikolas Klauser
6897ca460e
[libc++] Remove unnecessary friend declarations from <__tree> (#152133)
Removing the unnecessary friend declarations from `<__tree>` also
removes the need for forward declaration headers for `map` and `set`,
which this patch also removes.
2025-08-07 09:18:31 +02:00
Simon Pilgrim
6abf4f376e
[Headers][X86] Allow AVX movddup/movsldup/movshdup intrinsics to be used in constexpr (#152340)
Matches SSE3 handling
2025-08-07 08:17:31 +01:00