544850 Commits

Author SHA1 Message Date
Jannick Kremer
0da291f8a6 Revert "Move python binding tests to lit framework" (#149012)
This reverts commit f8707f994af2582f6dc58190106946efeb43bf05.

(cherry picked from commit 7a9bef0166951a61bc7094514a20471ae45f6090)
2025-07-22 10:33:35 +02:00
Aiden Grossman
cbe68e5140 [libcxx] Switch to release branch runners
This ensures that if/when we bump the toolchain versions in the main
container that we do not break tests on the release branch.
2025-07-22 10:32:35 +02:00
clubby789
186df07d01 [DSE] Remove uninitialized from allockind when creating dummy zeroed variant function (#149336)
cc https://github.com/llvm/llvm-project/pull/138299

rustc sets `allockind("uninitialized")` - if we copy the attributes
as-is when creating a dummy function, Verify complains about
`allockind("uninitialized,zeroed")` conflicting, so we need to clear the
flag.

Co-authored-by: Jamie Hill-Daniel <jamie@osec.io>
(cherry picked from commit 74c396afb26dec74c0b799e218c63f1a26e90d21)
2025-07-22 10:31:55 +02:00
Owen Pan
607677c861 [clang-format] Fix a regression of annotating PointerOrReference (#149039)
Fixes #149010

(cherry picked from commit a8f5e9ed6b44562938ce07e2790be90be8f0a6b5)
2025-07-22 10:31:35 +02:00
Tomohiro Kashiwada
e36a7daae2 [Support/BLAKE3] quick fix for Cygwin build (#148635)
BLAKE3 1.8.2 ( imported in d2ad63a193216d008c8161879a59c5f42e0125cc )
fails to build for the Cygwin target.

see: https://github.com/BLAKE3-team/BLAKE3/issues/494

As a temporary workaround, add `&& !defined(__CYGWIN__)` to BLAKE3
locally.

resolves https://github.com/llvm/llvm-project/issues/148365

(cherry picked from commit 8de61eb01c9752f0488ed8b52d01fe3d0873ff6c)
2025-07-22 10:30:43 +02:00
Tobias Hieta
f1846e747d Use Parallel xz for test-suite sources. (#149389)
(cherry picked from commit 867ff3001e4e1e68b3f26c5ead281ea2208c4c48)
2025-07-22 10:30:13 +02:00
Peter Collingbourne
728030a452 compiler-rt: test: Use the host instead of the target to select %expect_crash.
When running tests in a cross-compiled build, %expect_crash is
run on the host, not the target, so we need to check the host
OS. config.host_os surprisingly refers to the target OS because it
is derived from CMAKE_SYSTEM_NAME which specifies the target. See:
https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html

Another speculative fix for:
https://lab.llvm.org/buildbot/#/builders/193/builds/9070

(cherry picked from commit 968d38d1d7d9de2d5717457876bba2663b36f620)
2025-07-22 10:29:54 +02:00
Raphael Moreira Zinsly
1abeeabd65 [RISCV] Pass the MachineInstr flag as argument to allocateStack (#147531)
When not in the prologue we do not want to set the FrameSetup flag, by
passing the flag as argument we can use allocateStack correctly on those
cases.
This fixes the allocation and probe in eliminateCallFramePseudoInstr.

(cherry picked from commit 1db9eb23209826d9e799e68a9a4090f0328bf70c)
2025-07-21 18:54:42 +02:00
Tobias Hieta
cbcb48a88c Bump version to 21.1.0-rc1 llvmorg-21.1.0-rc1 2025-07-17 21:02:34 +02:00
Corentin Jabot
7ac3c62282 Revert "[Clang] Do not treat Foo -> const Foo conversion sequences as perfect" (#149272)
Reverts llvm/llvm-project#148613

Considering object argument conversion qualifications perfect leads to
situations where we prefer a non-template const qualified function over
a non-qualified template function, which is very wrong indeed.

I explored solutions to work around that, but instead, we might want to
go the GCC road and prefer the friend overload in the #147374 example,
as this seems a lot more consistent and reliable

(cherry picked from commit 28e1e7e1b4b059a2e42f68061475cddb4ad0a6a3)
2025-07-17 18:00:22 +02:00
Sirraide
dd7710b7fd [Clang] Reintroduce obsolete symbols in libclang.map (#149190)
This is a follow-up to #149079. Seems like we forgot about the fact that
the symbols also need to be in `libclang.map`.

(cherry picked from commit 7e0fde0c2f6b0b9d727ce9196956b36e91961ac4)
2025-07-17 17:59:42 +02:00
Yuxuan Chen
ad9051049d [Clang] Fix FE crash during CGCoroutine GRO Alloca Emission (#148962)
Fixes: https://github.com/llvm/llvm-project/issues/148953

Currently when coroutine return object type is const qualified, we don't
do direct emission. The regular emission logic assumed that the auto var
emission will always result in an `AllocaInst`. However, based on my
findings, NRVO var emissions don't result in `AllocaInst`s. Therefore,
this
[assertion](1a940bfff9/clang/lib/CodeGen/CGCoroutine.cpp (L712))
will fail.

Since the NRVOed returned object don't live on the coroutine frame, we
won't have the problem of it outliving the coroutine frame, therefore,
we can safely omit this metadata.

(cherry picked from commit c36156de45a0f5e24e7a4ee2259c3302ea814785)
2025-07-17 17:56:53 +02:00
Eli Friedman
2067574f54 [clang] Fix pointer comparisons between pointers to constexpr-unknown (#147663)
A constexpr-unknown reference can be equal to an arbitrary value, except
values allocated during constant evaluation. Fix the handling.

The standard is unclear exactly which pointer comparisons count as
"unknown" in this context; for example, in some cases we could use
alignment to prove two constexpr-unknown references are not equal. I
decided to ignore all the cases involving variables not allocated during
constant evaluation.

While looking at this, I also spotted that there might be issues with
lifetimes, but I didn't try to address it.

(cherry picked from commit 20c8e3c2a4744524396cc473a370cfb7855850b6)
2025-07-17 17:56:24 +02:00
Jonas Devlieghere
38158a93d8 [lldb] Document MCP tools & resources (#148708)
Add documentation for the tools and resources exposed by LLDB's MCP
server.

(cherry picked from commit e8dc96d9de14c4b2317b11b8bc6e9310113697b3)
2025-07-17 12:40:58 +02:00
Jonas Devlieghere
68e17aec8f [lldb] Add a release note for MCP support 2025-07-17 12:35:56 +02:00
Nikita Popov
194dd6679f [Support][BLAKE3] Restore static on blake3_hash4_neon (#149046)
This was dropped in #147948 and causes symbol conflicts if libblake3 is
also linked.

(cherry picked from commit 1754a7d5733d5305e4ec25ef0945b39d6882bb28)
2025-07-17 12:26:26 +02:00
Matt Arsenault
7c2c20dd9c RuntimeLibcalls: Fix calling conv of win32 div libcalls (#149098)
There's probably an existing test this should be added to,
but our test coverage is really bad that this wasn't caught
by one.

(cherry picked from commit 0110168f6aa5c8a8d02ffd9e62c7929ce6d24d26)
2025-07-17 10:29:47 +02:00
Aiden Grossman
46c566f579 [CI][Github] Switch windows to server 2022 (#148743)
This patch switches the windows testing over to server 2022 by switching
to the recently introduced runner set.

(cherry picked from commit 3248a6d76abccbbe78e853c76bc022b70d594347)
2025-07-17 10:29:31 +02:00
Sirraide
6ee4eedc2a [Clang] Reintroduce obsolete libclang symbols to avoid an ABI break (#149079)
For more context, see
https://github.com/llvm/llvm-project/pull/119269#issuecomment-3075444493,
but briefly, when removing ARCMigrate, I also removed some symbols in
libclang, which constitutes an ABI break that we don’t want, so this pr
reintroduces the removed symbols; the declarations are marked as
deprecated for future removal, and the implementations print an error
and do nothing, which is what we used to do when ARCMigrate was
disabled.

(cherry picked from commit 1600450f9098e5c9cb26840bd53f1be8a2559b7d)
2025-07-17 10:29:12 +02:00
Jordan Rupprecht
adb453c8a6 [Support][BLAKE3] Prefix more blake3 methods (#149007)
Added by #147948, blake3_xof_many and blake3_compress_subtree_wide cause
conflicts when linking llvm and blake3 statically into the same binary.
Similar to #148607.

(cherry picked from commit 60579ec3059b2b6cc9dad90eaac1ed363fc395a7)
2025-07-17 10:28:09 +02:00
Eli Friedman
04d4be501d [libclang] Fix version for symbol clang_visitCXXMethods (#148958)
Happened to spot this while looking at libclang.map for other reasons.
clang_visitCXXMethods was added in LLVM 21, not LLVM 20.

(cherry picked from commit 116110e1a93531a64d82f049b6e36403bc14f278)
2025-07-17 10:27:47 +02:00
Sudharsan Veeravalli
b71c9a4366 [RISCV] Fix issues in ORI to QC.INSBI transformation (#148809)
The transformation done in #147349 was incorrect since we were not
passing the input node of the `OR` instruction to the `QC.INSBI`
instruction leading to the generated instruction doing the wrong thing.
In order to do this we first needed to add the output register to
`QC.INSBI` as being both an input and output.

The code produced after the above fix will need a copy (mv) to preserve
the register input to the OR instruction if it has more than one use
making the transformation net neutral ( `6-byte QC.E.ORI/ORAI` vs
`2-byte C.MV + 4-byte QC.INSB`I). Avoid doing the transformation if
there is more than one use of the input register to the OR instruction.

(cherry picked from commit d67d91a9906366585162cebf292f923a3f28c8a6)
2025-07-17 10:27:16 +02:00
Craig Topper
49722f1df1 [RISCV] Remove incorrect and untested FrameIndex support from SelectAddrRegImm9. (#148779)
To fold a FrameIndex, we need to teach eliminateFrameIndex to respect
the uimm9 range.

(cherry picked from commit 63d099af146a19bc8fd5a791d6184125e6cc42e7)
2025-07-17 10:26:45 +02:00
Krzysztof Parzyszek
a0895b4581 [Frontend][OpenMP] Move isPrivatizingClause to OMP.h, NFC (#148644) 2025-07-16 16:17:00 +02:00
Sjoerd Meijer
7d803c868a [AArch64] Set the cache line size to 64 for the V2 and V3. (#148213)
This sets the cache line size to 64 for the Neoverse V2 and V3. I've
tested this with loop-interchange: it doesn't result in extra
compile-times, but it does enable a lot more interchange.
2025-07-16 16:17:00 +02:00
Sander de Smalen
d1517ec622 [AArch64] Ensure bundle expansion of MOVPRFX gets correct implicit ops (#148824)
By finalizing the bundle _after_ copying over the implicit-ops, it also
adds any implicit-defs to the BUNDLE.

Fixes https://github.com/llvm/llvm-project/issues/148645
2025-07-16 16:17:00 +02:00
Sander de Smalen
588b813079 [AArch64] Use correct regclass for spills of ZPR2/ZPR4 (#148806)
Commit a6293228fdd5aba8c04c63f02f3d017443feb3f2 forced the register
class of ZPR[24]StridedOrContiguous for spills/fills of ZPR2 and ZPR4,
but this may result in issues when the regclass for the fill is a
ZPR2/ZPR4 which would allow the register allocator to pick `z1_z2`,
which is not a supported register for ZPR2StridedOrContiguous that only
supports tuples of the form (strided) `z0_z8`, `z1_z9` or (contiguous,
start at multiple of 2) `z0_z1`, `z2_z3`. For spills we could add a new
register class that supports any of the tuple forms, but I've decided
to use two pseudos similar to the fills for consistency.

Fixes https://github.com/llvm/llvm-project/issues/148655
2025-07-16 16:17:00 +02:00
Martin Erhart
18624ae54b [mlir][SliceAnalysis] Fix stack overflow in graph regions (#139694)
This analysis currently just crashes when applied to a graph region that
has a use-def cycle. This PR fixes that by keeping track of the
operations the DFS has already visited when following use-def edges and
stopping once we visit an operation again.
2025-07-16 16:16:59 +02:00
Tobias Hieta
6296ebd45d Bump version to 21.1.0-git 2025-07-15 15:59:05 +02:00
Mohammadreza Ameri Mahabadian
94b15a1ece
[mlir][spirv] Add basic support for SPV_EXT_replicated_composites (#147067)
This patch introduces two new ops to the SPIR-V dialect:
- `spirv.EXT.ConstantCompositeReplicate`
- `spirv.EXT.SpecConstantCompositeReplicate`

These ops represent composite constants and specialization constants,
respectively, constructed by replicating a single splat constant across
all elements. They correspond to `SPV_EXT_replicated_composites`
extension instructions:
- `OpConstantCompositeReplicatedEXT`
- `OpSpecConstantCompositeReplicatedEXT`

No transformation to these new ops has been introduced in this patch.

This approach is chosen as per the discussions on RFC
https://discourse.llvm.org/t/rfc-basic-support-for-spv-ext-replicated-composites-in-mlir-spir-v-compile-time-constant-lowering-only/86987

---------

Signed-off-by: Mohammadreza Ameri Mahabadian <mohammadreza.amerimahabadian@arm.com>
2025-07-15 09:45:13 -04:00
Luke Lau
612afab512 [RISCV] Use MachineInstr::isFullCopy in a few places. NFC
Instead of checking that there's no subregisters.
2025-07-15 21:39:59 +08:00
Orlando Cazalet-Hyams
5977766bf6
[KeyInstr][Clang][NFC] Add test for array cookie store (#146517)
It doesn't need to be a Key Instruction.
2025-07-15 14:21:04 +01:00
Haohai Wen
8226fbee4b
[NFC] Extract pseudo probe using mdconst::extract (#148821)
mdconst::extract is more rigorous than mdconst::dyn_exract in this
context.
2025-07-15 21:05:52 +08:00
Ryotaro Kasuga
b3c293c5b9
[LoopInterchange] Drop nuw/nsw flags from reduction ops when interchanging (#148612)
Before this patch, when a reduction exists in the loop, the legality
check of LoopInterchange only verified if there exists a
non-reassociative floating-point instruction in the reduction
calculation. However, it is insufficient, because reordering integer
reductions can also lead to incorrect transformations. Consider the
following example:

```c
int A[2][2] = {
  { INT_MAX, INT_MAX },
  { INT_MIN, INT_MIN },
};

int sum = 0;
for (int i = 0; i < 2; i++)
  for (int j = 0; j < 2; j++)
    sum += A[j][i];
```

To make this exchange legal, we must drop nuw/nsw flags from the
instructions involved in the reduction operations.

This patch extends the legality check to correctly handle such cases. In
particular, for integer addition and multiplication, it verifies that
the nsw and nuw flags are set on involved instructions, and drop them
when the transformation actually performed. This patch also introduces
explicit checks for the kind of reduction and permits only those that
are known to be safe for interchange. Consequently, some "unknown"
reductions (at the moment, `FindFirst*` and `FindLast*`) are rejected.

Fix #148228
2025-07-15 22:04:16 +09:00
Orlando Cazalet-Hyams
9eb0fc8e57 Fix link in docs after #137991 2025-07-15 13:50:15 +01:00
Hugo Melder
0b784269f1
[CodeGen][ObjC] Include all referenced protocols in protocol list (#148827)
When constructing the protocol list in the class metadata generation
(`GenerateClass`), only the protocols from the base class are added but
not protocols declared in class extensions.

This is fixed by using `all_referenced_protocol_{begin, end}` instead of
`protocol_{begin, end}`, matching the behaviour on Apple platforms.

A unit test is included to check if all protocol metadata was emitted
and that no duplication occurs in the protocol list.

Fixes https://github.com/gnustep/libobjc2/issues/339

CC: @davidchisnall
2025-07-15 13:42:42 +01:00
Orlando Cazalet-Hyams
acffe8324b
[KeyInstr] Add docs (#137991)
This document explains the core ideas and some implementation details
of the Key Instructions project. The LLVM document also outlines the two
main limitations of our approach.

RFC:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-07-15 13:38:08 +01:00
David Spickett
17d9f2aee9 [clang][docs] Fix formatting in breaking changes note
Need to use double backticks to get plain text in RST.
2025-07-15 12:35:39 +00:00
Florian Hahn
cfdd5ca2ed
[LV] Add tests for fmin reductions without fast-math flags.
Some of those reductions can be vectorized with extra checks.

Extra tests for https://github.com/llvm/llvm-project/pull/148239 and
follow-ups.
2025-07-15 13:34:12 +01:00
David Spickett
a9cfe84d88 [llvm][docs] Correct formatting in lldb release note
When you use <> in markdown it thinks it's an HTML tag
and does not show anything.
2025-07-15 12:31:05 +00:00
Haojian Wu
a2b3110945
[clang] Reduce the small vector size for DeclTypeInfo. (#148788)
The `Declarator` class is large (4584 bytes) and used as a stack-local
variable during parsing.

This patch reduces the default size of its `DeclTypeInfo` member,
reducing the overall size down to 3880 bytes. This allows clang handle
more deeply nested expressions without exhausting the stack.

Combined with #148726, the nesting threshold for such expressions
increases to `~1100`.

No performance impact being
[observed](https://llvm-compile-time-tracker.com/compare.php?from=d4f5ed6a23464cbe831820cb695aa1d39b11e4aa&to=66ba54b8a295cc2759387ef2a4a162de2ad4946e&stat=instructions:u).
2025-07-15 13:44:24 +02:00
Haojian Wu
2a9afdb793
[clang] Reduce the size of ParsedAttributesView and AttributePool (#148726)
These objects are used as local stack variables during parsing, and they
are not small. This patch reduces their sizes:

* `ParsedAttributesView`: 72 → 40 bytes
* `AttributePool`: 72 → 40 bytes

No negative performance impact has been
[observed](https://llvm-compile-time-tracker.com/compare.php?from=a709621cd545b061782b03136286227867b452a6&to=f50500b3c178e97c0c861301e853e6d5b859040b&stat=instructions:u).

**Context:**
We have some verilator-generated code with extremely deep nesting of
parenthesized expressions, e.g.:

```cpp
bool s = 
(...(bool)(i[0])
 |(bool)(i[1]))
 |(bool)(i[2]))
 | ...
 |(bool)(i[n]));
```

Before this patch, on my local machine, Clang begins emitting
`-Wstack-exhausted` when `n` is 715. After the patch, that threshold
increases to `950`.
2025-07-15 13:43:50 +02:00
Corentin Jabot
57d81c23f4
[Clang] Remove explicit object from non member function. (#148807)
To avoid crashing later (as we assume only member functions can have
explicit object parameters)

Fixes #113185
2025-07-15 13:34:32 +02:00
Vikram Hegde
8cbcaee7fe
[CodeGen][NPM] Register Function Passes (#148109)
same as https://github.com/llvm/llvm-project/pull/138828,

Co-authored-by : Oke, Akshat
<[Akshat.Oke@amd.com](mailto:Akshat.Oke@amd.com)>
2025-07-15 17:01:28 +05:30
Matt Arsenault
2f70e074f2
XCore: Add frexp intrinsic test (#148676) 2025-07-15 20:31:05 +09:00
Fraser Cormack
8a7a64873b
[libclc] Move CMake for prepare_builtins to a subdirectory (#148815)
This simply makes things better self-contained.
2025-07-15 12:26:11 +01:00
Amr Hesham
b3240b4889
[CIR][NFC] Fix LoweringPrepare pass multi lines summary (#148826)
Fix the Lowering Prepare a multi-line summary
2025-07-15 13:15:25 +02:00
Jannick Kremer
ec149d5ef8
[clang][python][test] Move python binding tests to lit framework (#148802)
As discussed in PR #142353, the current testsuite of the `clang` Python
bindings has several issues:

- It `libclang.so` cannot be loaded into `python` to run the testsuite,
the whole `ninja check-all` aborts.
- The result of running the testsuite isn't report like the `lit`-based
tests, rendering them almost invisible.
- The testsuite is disabled in a non-obvious way (`RUN_PYTHON_TESTS`) in
`tests/CMakeLists.txt`, which again doesn't show up in the test results.

All these issues can be avoided by integrating the Python bindings tests
with `lit`, which is what this patch does:

- The actual test lives in `clang/test/bindings/python/bindings.sh` and
is run by `lit`.
- The current `clang/bindings/python/tests` directory (minus the
now-subperfluous `CMakeLists.txt`) is moved into the same directory.
- The check if `libclang` is loadable (originally from PR #142353) is
now handled via a new `lit` feature, `libclang-loadable`.
- The various ways to disable the tests have been turned into `XFAIL`s
as appropriate. This isn't complete and not completely tested yet.

Tested on `sparc-sun-solaris2.11`, `sparcv9-sun-solaris2.11`,
`i386-pc-solaris2.11`, `amd64-pc-solaris2.11`, `i686-pc-linux-gnu`, and
`x86_64-pc-linux-gnu`.

Co-authored-by: Rainer Orth <ro@gcc.gnu.org>
2025-07-15 12:48:24 +02:00
William Huynh
0425a5df4d
[libc] Add hooks for extra options in running hermetic tests (#147931)
Part of #145349. These hooks are required downstream in order to run
hermetic tests. See https://github.com/arm/arm-toolchain/pull/420 for
more context on how this PR will be used.
2025-07-15 11:43:51 +01:00
Nikolas Klauser
339a1f2e8f
Revert "[libc++][hardening] Introduce assertion semantics" (#148822)
Reverts llvm/llvm-project#148268

It looks like this was based on #148266, which I reverted in #148787.
2025-07-15 12:43:37 +02:00