Commit graph

590905 commits

Author SHA1 Message Date
Zeyi Xu
037a0f40a8
[RISCV][MC] Add experimental Smcsps and Sscsps support (#211712)
Add experimental v0.19 support for the `Smcsps` and `Sscsps` conditional
stack pointer swap extensions.
2026-08-01 11:05:22 +08:00
Fangrui Song
54d05e9077
[SPARC] Parse %r_disp32 in data directives (#213398)
commit fd5c1f9497 (2014) emits %r_disp32 for pc_rel entries in
.gcc_except_table and .eh_frame, but the specifier is only recognized in
instruction operands, so llvm-mc cannot reassemble llc output.

Implement parseDataExpr with a data specifier table holding just
%r_disp32, and reject %r_disp32 outside a .word directive and in
instruction operands.

Supersedes #208933.
2026-08-01 02:52:28 +00:00
crZhao
ef19256d33
[mlir][Shard] Propagate failures in ConvertShardToMPI (#211713)
This PR fixes a crash in ConvertShardToMPI caused by ignoring a failed partial conversion and continuing to apply folding patterns to partially converted IR.

Assisted-by: codex

---------

Co-authored-by: Maksim Levental <maksim.levental@gmail.com>
2026-07-31 19:24:21 -07:00
Fangrui Song
2e81492b8a
[BFI] Simplify irreducible header discovery. NFC (#213213)
IrreducibleGraph is the explicit graph of a region -- a loop, or the
whole function -- that BFI searches for irreducible SCCs. It maintains
predecessor lists only so findIrreducibleHeaders can ask of each node
whether a predecessor lies outside its SCC (an entry), and whether a
non-entry in the same SCC reaches it via a backedge (an extra header).

Answer both from the successor lists instead; IrrNode then needs only a
successor vector. findIrreducibleHeaders is left partitioning the SCC
its sole caller is packaging, so fold it into createIrreducibleLoop.
Headers and members are sorted, so the changed iteration order does not
affect output.

Once BFI uses CycleInfo, a region's irreducible SCCs are its
non-reducible child cycles, which should let IrreducibleGraph go away
entirely. That removal has no predecessor lists to walk and
getResolvedNode has no inverse, so it must sweep successors regardless;
settling the formulation here leaves it changing only the graph.

Aided by Claude Opus 5
2026-07-31 19:04:36 -07:00
Jonas Devlieghere
cc7d719fd9
[lldb] Launch the Wasm runtime with the file the target has (#213384)
PlatformWasm hands the runtime the module to run as a path on the host
it launches the runtime on. It takes that path from the launch info,
whose executable is the name the module goes by on the platform. That
name is whatever a stub reported the module under, which need not be a
path that resolves on this host, so a relaunch runs a file that does not
exist:

```
(lldb) run
error: WebAssembly runtime exited with exit code 255
```

Run the file the target has instead. Only a runtime launched on this
host is affected, since a connection to a remote Wasm platform delegates
the launch to that platform.
2026-07-31 18:40:15 -07:00
Maksim Levental
6c82ca141a
[mlir-c] Add RewriterBase insertion point save/restore (#206531)
Exposes `OpBuilder::saveInsertionPoint` / `restoreInsertionPoint` through the MLIR C API for `MlirRewriterBase`, continuing the buildout of the rewrite/conversion C bindings.

Assisted by: Claude
2026-07-31 18:00:45 -07:00
Med Ismail Bennani
fd999b4c8b
[lldb/Interpreter] Surface Python exceptions from scripted extensions (#198153) 2026-07-31 17:51:12 -07:00
jimingham
956e241997
Disable this test on Darwin to give the author a chance to fix it. (#213388)
The test is passing elsewhere.

I filed:

https://github.com/llvm/llvm-project/issues/213386

to cover fixing the issue and re-enabling the tests.
2026-07-31 17:41:42 -07:00
LU-JOHN
eda2fb2d41
[AMDGPU] Fix canonicalization of undef in v2f16 (#213373)
When processing canonicalization with an undef in v2f16,
1. If the other element is constant, create a splat vector
2. Otherwise, convert undef to 0.0.

Update comment to make this behavior clear. Do not imply that a v2f16
with two undef's should be unconverted. Do not state that conversion of
undef to qNan is normal. `ConstantFoldScalarCall1` in
`llvm/lib/Analysis/ConstantFolding.cpp` already canonicalizes an undef
to 0.0.

Previous code only converted element 0 if element 1 was a constant.

Signed-off-by: John Lu <John.Lu@amd.com>
2026-07-31 19:34:21 -05:00
David Green
83eec36fcf
[AArch64][GlobalISel] Replace uses of getRegBank(GPRRegBankID) with GPRRegBank. NFC (#213387) 2026-08-01 01:30:12 +01:00
jimingham
35a8074759
Disable the tests in TestOSIndSYM.py (#213382)
I filed:  github.com/llvm/llvm-project/issues/213380

to cover this issue.  I'm disabling this one test till that is fixed.
2026-07-31 17:22:35 -07:00
vangthao95
c3b2b425b9
AMDGPU/GlobalISel: Switch more FP opcodes to extended LLTs (part 4) (#213353)
Migrate G_FFREXP, G_FMODF, rounding operations, and the LOG/EXP families
to extended LLTs.

Remove f64 for G_FLOG and G_FLOG10 since there is no custom lowering for
them. Adjust G_AND masking for LOG/EXP using extended LLTs.

Update the relevant MIR tests and *.ll tests.
2026-07-31 17:18:03 -07:00
Michael Jones
9001032630
[libc] Move generated elf header to include (#211428)
The fact that `hdr/elf_proxy.h` was generated with headergen was causing
dependency issues. This shouldn't be necessary, and this PR moves it out
into `include` to avoid needing headergen for an overlay build.

Assisted-by: Automated tooling, human reviewed.
2026-07-31 16:37:32 -07:00
Tom Stellard
09734937d3
workflows/llvm-abi-tests: Cache the baseline abi (#211968)
This way we don't need to recompute it for every workflow.
2026-07-31 16:32:37 -07:00
Ayokunle Amodu
b0511699c3
[CIR][AMDGPU] Add support for AMDGCN ldexp builtins (#198087)
Adds support for the following AMDGCN ldexp builtins:

- __builtin_amdgcn_ldexp (double)
- __builtin_amdgcn_ldexpf (float)
- __builtin_amdgcn_ldexph (half)

These are lowered to the `llvm.ldexp` intrinsic.
2026-07-31 19:18:49 -04:00
Valentin Clement (バレンタイン クレメン)
362d72f638
[flang][NFC] Rename modfile84.f90 to modfile85.f90 (#213371)
Avoid clash on case insensitive system
2026-07-31 19:02:09 -04:00
Thurston Dang
38d27329ec
[DropAssumes] Print drop-deref in pipeline where appropriate (#211905)
drop-deref was added as an option in #166947 and is parsed correctly,
but is not serialized. This can make it difficult to reduce test cases,
especially automatically with llvm/utils/reduce_pipeline.py.

This patch implements printPipeline() to serialize drop-deref where
appropriate.
2026-07-31 15:28:13 -07:00
Moazin K.
458b207bd6
[OpenACC][NFC] Minor clean up in ACCRoutineLowering. (#213333)
Minor NFC clean up after recent changes to remove nohost handling from
ACCRoutineLowering.

Assisted-by: Codex
2026-07-31 15:21:46 -07:00
Simon Pilgrim
d0d8c85410
[X86] getTargetConstantBitsFromNode - ensure constant data is from a vector type (#213360)
Fixes #213251
2026-07-31 22:17:07 +00:00
Sam Elliott
1cf3b70dab
[IPO] Remove IR Outliner (#211971)
The IR Outliner has major bugs and no active maintainer, and is disabled
by default. The new LLVM Policy states the pass should be removed.

This commit removes:
- The IROutliner pass
- The IRSimilarity analysis
- The `llvm-sim` executable, used for understanding the latter
- All tests of the above

Related discussion:
https://discourse.llvm.org/t/ir-outliner-status-interest/89672
2026-07-31 15:03:31 -07:00
Zhen Wang
5ca2b9313c
[flang-rt][cuda] Skip scope-exit cleanup when the context has a sticky error (#213184)
A sticky CUDA error (e.g. an illegal memory access in a kernel) leaves
the primary context active but unusable, so CUFDeviceIsActive() reports
it as fine and the compiler-generated scope-exit frees abort a program
that ran to completion: 'cudaFree(p)' failed with
'cudaErrorIllegalAddress'.

Detect this by freeing a null pointer, a no-op that still reports the
sticky error. It runs only once the primary context is known active, so
it cannot lazily create one.
2026-07-31 14:38:24 -07:00
Alexey Bataev
36187ce08a
[SLP][NFC]Add an extra check for fmul to fmuladd promotion, NFC
Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/213361
2026-07-31 17:38:16 -04:00
Alexey Bataev
96c356ab71
[SLP]Keep scheduled order when moving body in alias-check versioning
The scheduler physically reorders the block before versioning, and
emission insertion points depend on that order. Moving the body by the
pre-scheduling snapshot scrambled it and produced use-before-def IR.
Move in the block's current order instead, filtered to the original
body so the emitted check instructions stay in the header block.

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/213358
2026-07-31 17:32:04 -04:00
Joseph Huber
a10e70b5d7
[NVPTX] Pass -Xcuda-ptxas to the nvlink wrapper for LTO (#213351)
Summary:
This allows `-foffload-lto -fgpu-rdc -Xcuda-ptxas` to work properly by
forwarding it.
2026-07-31 16:24:50 -05:00
Igor Kudrin
320164daab
[lldb] Avoid returning a stale AddressOf (#212915)
The 'ValueObject::AddressOf()' method assumes that the address of a
value object cannot change, so when it is calculated once, it does not
need to be updated afterwards. However, this is not the case if the
'ValueObject' is a dependent object obtained by calling 'Dereference()'
of another 'ValueObject'. If the latter object is changed, the dependent
value object should return a new address from the 'AddressOf()' method
to reflect the change.
2026-07-31 14:19:53 -07:00
Tom Stellard
e423bace20
workflows/require-team-membership: Fix typo (#212686) 2026-07-31 14:00:41 -07:00
Akshay K
230e5d9a02
[AArch64] Fix zero-call-used-regs crash on targets without NEON (#211603)
## Summary

`-fzero-call-used-regs=all` crashes on AArch64 targets without NEON
support, such as `-mgeneral-regs-only` or `-march=armv8-a+nosimd`. The
former is a common configuration used by the Linux kernel.

```c
int p(int a) { return a + 1; }
```

```sh
$ clang --target=aarch64-linux-gnu -O2 -S -mgeneral-regs-only \
        -fzero-call-used-regs=all test.c -o -

Assertion failed: (STI.hasNEON() && "Expected to have NEON."),
buildClearRegister
```

## Cause

`buildClearRegister()` assumes clearing floating-point registers always
requires NEON. However, `-march=armv8-a+nosimd` still has the Armv8
floating-point extension, so FP registers must be cleared without NEON,
while `-mgeneral-regs-only` has no FP support but still collects FP
registers for clearing.

## Fix

Replace the `hasNEON()` assertion with `hasFPARMv8()` for the no-NEON FP
case, and skip collecting floating-point registers entirely when the
target has no Armv8 floating-point support.

**Fixes:** #211151

Assisted-by: Cursor
2026-07-31 13:56:50 -07:00
Adam Smith
ec2bf56676
[Clang][Sema] Synthesize a memcpy body for defaulted union assignment (#206579)
A defaulted copy or move assignment operator for a union is synthesized
with an empty body. `DefineImplicitCopyAssignment` /
`DefineImplicitMoveAssignment` skip union members in the memberwise
loop, and the implied copy of the object representation has no AST
representation, a FIXME that has sat at that skip for a long time. The
operator ends up copying nothing.

Classic CodeGen hides this at ordinary call sites by lowering a trivial
assignment to a memcpy at the call site, so `u1 = u2` works even though
the operator body is a no-op. But when the operator is genuinely called,
through a pointer-to-member for instance, it silently copies nothing.
ClangIR calls the assignment operator at the call site rather than
eliding it, so it hits the empty body directly and drops every union
assignment. The no-op is then deleted at `-O3`. That is the MultiSource
`kc` miscompile, where a `YYSTYPE` union assignment (`*++yyvsp =
yylval`) becomes a no-op.

This implements the FIXME by mirroring the defaulted union copy
constructor (`CGClass.cpp`: "union copy constructor, we must emit a
memcpy") in the AST: when the class is a union,
`DefineImplicit{Copy,Move}Assignment` emits a single whole-object copy
through `buildMemcpyForAssignmentOp`, the helper already used for
trivially-copyable array members, instead of the skipped per-member
assignments. The operator stays trivial (triviality is fixed at
declaration time, before the body is synthesized), so constant
evaluation, which copies trivial unions through its own semantic path
and never executes the body, is unchanged.

Copying the object representation is correct even when a union member is
not trivially copyable, but the synthesized memcpy would then trip
`-Wnontrivial-memcall`. A `void*` cast would drop pointee qualifiers
such as the address space and inject an explicit cast node the source
never wrote. Instead the call keeps its typed union-pointer arguments,
and the union branch in `DefineImplicit{Copy,Move}Assignment` wraps the
build in `IgnoreAllWarningDiagRAII`, a save-and-restore around the
engine's existing ignore-all-warnings state. `CheckMemaccessArguments`
defers the warning and its note through `DiagRuntimeBehavior`, and that
queue flushes after the RAII has restored the previous ignore state, so
`DiagIfReachable` samples that state as it enqueues and drops what is
not error-class. Under `-w` the same queue is discarded before it
flushes, so nothing outside the scoped region changes.

Classic CodeGen now emits the copy when the operator is odr-used, and
ClangIR's union assignment lowers to a real memcpy. On the Sema side,
tests cover the synthesized AST for the implicit-`this` and C++23
explicit-object spellings, the `-Wnontrivial-memcall` suppression, the
preserved address space, the clean `-ast-print` output, and constexpr
active-member copy. The classic and ClangIR lowering is checked across
named, anonymous, and tail-padded unions.

#198918 added a defaulted-union `errorNYI` in ClangIR and deferred this
AST fix to a separate change. This PR makes that fix and drops the
guard, so the now-non-empty body lowers to a `cir.call @memcpy` instead
of erroring. Its own `union-copy-move-assignment.cpp` CIR test, which
expects that call, is the regression check.
2026-07-31 15:49:40 -05:00
Daniel Scherzer
6512cd96dd
[compiler-rt] [docs] Clean up explanation of __fixunsdfdi (#212624)
Replace "is compiling into" with "results in"

---------

Co-authored-by: hulxv <hulxxv@gmail.com>
2026-07-31 23:43:07 +03:00
Valentin Clement (バレンタイン クレメン)
f99ee4f26d
[flang][cuda][openacc] Emit an error when CUDA symbols are imported with CUDA disabled (#205427)
Only look for for module symbols.
2026-07-31 13:20:18 -07:00
Marlus Cadanus da Costa
68b7feaa62
[clang] Follow-up fixes for offsetof unsigned index change (#207808)
- Rename CastNoOverflow to CastAPToOffsetIndex for clarity
- Add parentheses in overflow guard condition in InterpBuiltin.cpp
- Improve comment explaining why 0x8000000000000000 is rejected

AI Tool Use: GitHub Copilot (Claude Sonnet 4.6) was used to assist in
identifying and drafting the fix. The fix was reviewed, tested, and
validated manually.

---------

Co-authored-by: Cadanus da Costa <maccosta@beenox.com>
2026-08-01 04:18:42 +08:00
forking-google-bazel-bot[bot]
582f9242ef
[Bazel] Fixes 71e5cb7 (#213330)
This fixes 71e5cb7526 (#213165).

Buildkite error link:
https://buildkite.com/llvm-project/upstream-bazel/builds?commit=71e5cb7526151701f2e2c4e37eaa20d1763c7cd4

Co-authored-by: Google Bazel Bot <google-bazel-bot@google.com>
2026-07-31 13:13:33 -07:00
Tom Stellard
02bde07167
workflows/release-binaries: Move environment declaration to upload job (#212687)
This is the only job that actually needs to use the environment secrets,
so the environment must be declared. We were using secrets in the
prepare job to do a permissions check, but this is unnecessary, because
that job does not do anything that is security sensitive.

Only the upload job needs to have these permission checks and these are
already included in the upload-release-artifact composite action.
2026-07-31 13:00:46 -07:00
AntonyCJ30
8631e82ddb
[LoopFusion] Allow loop fusion for idempotent output dependency (#206401)
Loop Fusion incorrectly blocks fusion of loops that write the same value
to two arrays.  Writing the same value twice produces identical observable results
regardless of execution order, so fusion is safe (whether the two arrays are aliased or not). 

Fixes #94676

Co-authored-by: AntonyCJ30 <cj6186609@gmail@gmail.com>
2026-07-31 15:58:26 -04:00
Arseniy Obolenskiy
e0162ea5dc
[AMDGPU] Do not treat bitcast across FP types as canonicality-preserving (#203560)
isCanonicalized recursed through ISD::BITCAST ignoring the type change,
so value canonical as v2bf16 was wrongly treated as canonical when
bitcast to v2f16 (that has different exponent width), dropping a
required fcanonicalize
2026-07-31 21:44:24 +02:00
Arseniy Obolenskiy
b53cccf32f
[AMDGPU] Fix ImageIntrinsicOptimizer DMask check starting at wrong arg index (#213264) 2026-07-31 21:42:30 +02:00
Matt Arsenault
55f3ddff49
AMDGPU: Separate image_msaa_load from bvh-ray-tracing-insts (#213270)
Add a separate msaa-load-insts feature so image_msaa_load is available
on gfx13, which has it but not the BVH intersect-ray instructions. These
were assumed to be the same feature previously, but gfx13 does not have the
bvh instructions, but does have image_msaa_load.

Co-authored-by: Claude (Claude-Opus-4.8)
2026-07-31 19:35:56 +00:00
Joseph Huber
14ec3c42ce
[Offload] add 'olIterateSymbols' runtime function (#213036)
Summary:
This provides users with a way to check all symbols present in a given
program. This is useful for many cases where a power user wants to do
something dynamic with the objects present.
2026-07-31 14:29:06 -05:00
Paulius Velesko
7ef0ca2b13
Reland "[HIPSPV] Add in-tree SPIR-V backend support for chipStar" (#213052)
Relands #206910 (reverted in #213088) with the fix for the breakage.

IsIntegratedBackendDefault() was tied to whether the SPIR-V backend is
registered, but it also controls whether clang collapses the compile and
backend
jobs, so builds without the SPIR-V target split every HIPSPV RDC device
compile
and failed hipspv-toolchain-rdc.hip. The default is back to the base
class value
and the translator fallback is decided in
constructLinkAndEmitSpirvCommand.
Third commit adds a test not guarded by spirv-registered-target.

Validated in X86;SPIRV and X86 only builds: driver tests pass in both,
and
non-RDC plus RDC (new driver) flows run for real emit spirv-val clean
modules
via the backend and via llvm-spirv respectively.
2026-07-31 15:23:48 -04:00
Alexey Bataev
54fedf4ed1
[SLP]Fix miscompile from poison base in alias-check versioning
Emit the runtime alias check while the block is still fully connected.
LCSSA-preserving SCEV expansion rewrites out-of-loop uses of
loop-defined bases to poison in predecessor-less blocks, corrupting
both the moved body and the scalar fallback clone.

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/213338
2026-07-31 15:08:11 -04:00
Matt Arsenault
c3fe6957de
CSKY: Consume "float-abi" module flag (#212975)
Start respecting float-abi, and fall back on the TargetOptions
field if not present.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-07-31 19:06:33 +00:00
Alexey Bataev
93a1495bcc
[SLP][NFC]Add a test with the runtime checks miscompilation, NFC
Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/213336
2026-07-31 15:01:02 -04:00
Nico Weber
1e089f19b2
[gn build] Port d9278ad4e6 (#213335) 2026-07-31 14:58:55 -04:00
Nico Weber
ae14df3fd7
[gn build] Port 0a1f0aafed (#213334) 2026-07-31 14:58:03 -04:00
Ayokunle Amodu
00e7c3564c
[CIR][AMDGPU] Add support for AMDGCN tanh builtins (#197852)
Adds codegen for the following AMDGCN tanh builtins:

- __builtin_amdgcn_tanhf (float)
- __builtin_amdgcn_tanhh (half)
- __builtin_amdgcn_tanh_bf16 (bfloat16)

These are lowered to the corresponding `llvm.amdgcn.tanh` intrinsic.
2026-07-31 14:57:40 -04:00
Ayokunle Amodu
3ece94d8f3
[CIR][AMDGPU] Add support for AMDGCN trig_preop builtins (#197399)
Adds codegen for the following AMDGCN trigonometric pre-operation
builtins:

- __builtin_amdgcn_trig_preop (double)
- __builtin_amdgcn_trig_preopf (float)

These are lowered to the corresponding `llvm.amdgcn.trig.preop`
intrinsic.
2026-07-31 14:55:38 -04:00
Folkert de Vries
460c1d327b
[NFC][PowerPC] add ppcf128 tests for fneg and nofpclass (#213307) 2026-07-31 20:52:08 +02:00
Tom Stellard
22308c4c51
workflows/release-sources: Pass release-version to upload-release-artifacts (#212660)
This was omitted from a8ccd42ab2.
2026-07-31 11:51:25 -07:00
Ryan Buchner
6d7c951e14
[SLP] Add tests for overcosted scalar splats for RISCV (#213142)
Tests for #213104.
2026-07-31 11:36:49 -07:00
Zane Hambly
ae2261652f
[X86] Don't emit personality info when the personality is not a function (#212803)
Follow-up to #212417, another one in the same corner.

`llc -mtriple=x86_64-pc-windows-msvc` crashes on a function whose
personality isn't a function:

```llvm
define void @a() personality ptr null {
  ret void
}
```

`dyn_cast<Function>` gives null, and `beginFunclet` hands that straight
to `getSymbol`, which dereferences it.

`DwarfCFIException` already guards against this, applying the null check
to both branches:

```cpp
shouldEmitPersonality =
    (forceEmitPersonality ||
     (hasLandingPads && PerEncoding != dwarf::DW_EH_PE_omit)) && Per;
```

`WinException` has it inside the second operand, so
`forceEmitPersonality` bypasses it. Move it out so it gates both,
matching the Dwarf path.

The test covers both directions: the null personality no longer emits a
handler, and a real personality with a landing pad still emits
`.seh_handler __CxxFrameHandler3` as before. `CodeGen/WinEH` is 19/19.

Fixes #210285
2026-07-31 20:35:10 +02:00