575475 Commits

Author SHA1 Message Date
Valentin Clement (バレンタイン クレメン)
77e32a749f
[flang][cuda] Avoid false semantic error on unified array component (#190389) 2026-04-03 14:13:28 -07:00
Eli Friedman
9471fabf8a
[clang] Fix issues with const/pure on varargs function. (#190252)
There are two related issues here. On the declaration/definition side,
we need to make sure the markings are conservative. Then on the caller
side, we need to make sure we don't access parameters that don't exist.

Fixes #187535.
2026-04-03 13:57:35 -07:00
SiliconA-Z
c061f33f66
[ARM] Add new test that will demonstrate the cmn node in the ARM backend (NFC) (#179282)
No code changes yet, but this is going to change once the cmn node lands
in the backend.
2026-04-03 13:57:00 -07:00
Jonas Devlieghere
0732841440
Revert "[lldb/test] Codesign executables built with custom Makefile rules" (#190398)
Reverts llvm/llvm-project#189902 because this seems to cause hangs.
2026-04-03 20:42:29 +00:00
Jonas Devlieghere
1bbcc5ea51
[lldb] Fix the macOS builld after address size was removed from Stream (#190399)
This fixes the macOS build after #190375.
2026-04-03 20:40:06 +00:00
lntue
c34c0442ee
[libc] Add str_to_* and rpc_* shared tests. (#190351)
Also fix several things for LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE to
make them build.
2026-04-03 16:34:23 -04:00
Paul Kirth
1deab59f6f
[clang-doc] Migrate Namespaces to arena allocation (#190048)
This patch allocates the NamespaceInfo types in the local arenas, and
adapts the merging logic for the new list type and its children.
Memory use and performance improve slightly. Micro-benchmarks show a
regression in merge operations due to the more complex list operations.

 ## Build Clang-Doc Documentation
| Metric | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| Time | 920.5s | 1009.2s | 1002.4s | +8.9% | -0.7% |
| Memory | 86.0G | 43.2G | 43.9G | -49.0% | +1.6% |

 ## Microbenchmarks (Filtered for >1% Delta)
| Benchmark | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| BM_BitcodeReader_Scale/10 | 67.9us | 69.7us | 69.3us | +1.9% | -0.7% |
| BM_BitcodeReader_Scale/10000 | 70.5ms | 22.3ms | 24.8ms | -64.8% |
+11.4% |
| BM_BitcodeReader_Scale/4096 | 23.2ms | 4.7ms | 4.4ms | -80.9% | -5.7%
|
| BM_BitcodeReader_Scale/512 | 509.4us | 558.7us | 540.2us | +6.0% |
-3.3% |
| BM_BitcodeReader_Scale/64 | 114.8us | 119.2us | 117.0us | +1.9% |
-1.8% |
| BM_EmitInfoFunction | 1.6us | 1.6us | 1.6us | -1.1% | +0.8% |
| BM_Index_Insertion/10 | 2.3us | 4.2us | 3.7us | +61.7% | -11.3% |
| BM_Index_Insertion/10000 | 3.1ms | 5.4ms | 4.9ms | +56.8% | -9.1% |
| BM_Index_Insertion/4096 | 1.3ms | 2.2ms | 2.0ms | +54.5% | -8.2% |
| BM_Index_Insertion/512 | 153.6us | 259.6us | 236.7us | +54.1% | -8.8%
|
| BM_Index_Insertion/64 | 18.1us | 30.7us | 27.9us | +54.5% | -9.0% |
| BM_JSONGenerator_Scale/10 | 36.8us | 37.6us | 36.6us | -0.7% | -2.7% |
| BM_JSONGenerator_Scale/4096 | 33.7ms | 34.3ms | 34.2ms | +1.4% | -0.3%
|
| BM_JSONGenerator_Scale/64 | 222.4us | 225.6us | 220.2us | -1.0% |
-2.4% |
| BM_Mapper_Scale/10 | 2.5ms | 2.5ms | 2.5ms | -1.4% | -1.7% |
| BM_Mapper_Scale/10000 | 104.3ms | 109.3ms | 105.9ms | +1.6% | -3.1% |
| BM_Mapper_Scale/4096 | 44.3ms | 43.9ms | 44.7ms | +0.8% | +1.8% |
| BM_Mapper_Scale/512 | 7.6ms | 7.6ms | 7.6ms | +0.8% | +1.2% |
| BM_MergeInfos_Scale/10000 | 12.2ms | 1.6ms | 2.0ms | -83.6% | +28.7% |
| BM_MergeInfos_Scale/2 | 1.9us | 1.7us | 1.7us | -8.1% | +0.9% |
| BM_MergeInfos_Scale/4096 | 2.8ms | 520.5us | 557.4us | -79.9% | +7.1%
|
| BM_MergeInfos_Scale/512 | 68.9us | 37.9us | 39.9us | -42.0% | +5.3% |
| BM_MergeInfos_Scale/64 | 10.3us | 6.3us | 6.5us | -36.7% | +2.7% |
| BM_MergeInfos_Scale/8 | 2.8us | 2.2us | 2.2us | -20.7% | +1.2% |
| BM_SerializeFunctionInfo | 25.5us | 25.8us | 26.1us | +2.1% | +1.1% |
2026-04-03 20:33:56 +00:00
Brian Cain
98ced6cfd0
[BOLT] Template patchELFPHDRTable and rewriteNoteSections for ELF32 (#189715)
Template patchELFPHDRTable, rewriteNoteSections, markGnuRelroSections,
and discoverStorage to support both ELF32LE and ELF64LE binaries.
Previously these functions were hardcoded for ELF64LE, causing crashes
when processing 32-bit ELF binaries.

The RewriteInstance constructor now accepts ELF32LE objects in addition
to ELF64LE. The ELF_FUNCTION macro is reused (and moved earlier in the
header) to dispatch to the correct template instantiation.

These changes are preparation for adding support to hexagon architecture
in Bolt.
2026-04-03 15:16:31 -05:00
Joseph Huber
8a8434f22a
[OpenMP] Move alloc / free shared from TLI to alloc tags (#190365)
Summary:
Allocation kinds were added after these were introduced. We only needed
the TLI to identify these in the attributor so we can now just use
attributes. Update the usage in OpenMP and drop the TLI interface.

Fixes: https://github.com/llvm/llvm-project/issues/190072
2026-04-03 15:15:48 -05:00
Alexis Engelke
4a7213867a
[Analysis] No block map in MemoryDependenceAnalysis (#190367)
Avoid expensive hash map of block to value by using a vector. To avoid
allocating and clearing the entire vector per query, cache the
allocation and use an epoch to identify stale values from previous
queries.
2026-04-03 22:13:11 +02:00
Brian Cain
efdbf7b815
[Hexagon] Use trap0(#0xDB) for debugtrap instead of brkpt (#189446)
The brkpt instruction is intended for the in-silicon debugger (ISDB).
When ISDB is not enabled, brkpt is treated as a NOP, so
__builtin_debugtrap() would silently do nothing in user-mode Linux
processes.

Use trap0(#0xDB) instead.
2026-04-03 15:12:49 -05:00
Florian Hahn
6476619f30
[Matrix] Use matrix element type for TBAA nodes. (#190029)
Matrix loads and stores are accesses of their element types. Emit TBAA
nodes using their element type to allow more precise TBAA alias
analysis.

PR: https://github.com/llvm/llvm-project/pull/190029
2026-04-03 20:11:04 +00:00
Alexis Engelke
6c82b72db6
[SROA][NFC] Don't materialize name when discarding names (#190368)
SetValuePrefix has to materialize the prefix into a std::string, which
is non-free and pointless when value names are discarded.
2026-04-03 22:00:44 +02:00
Alexey Karyakin
6f464d1b3a
[Hexagon] Clean up library and include paths and fix --sysroot (#188824)
Unify include and library paths by reusing common code to compute path
prefixes. First, determine the effective sysroot by choosing a
user-provided sysroot, "../target/<triple>", or "../target/hexagon",
in the order of precedence. Based on the sysroot, derive the standard
include path, C++ include path, and base library path.

Fix the default -L library paths so they are taken from the external
sysroot, when one specified. Previously, these paths were always
relative to the install directory and sysroot was ignored.

Remove certain locations from considerations, as there are never used
for the corresponding purpose in existing sysroots:
- fallback to install path, typically "../target/bin", as the base path
  when other sysroot cannot be found;
- similarly, fallback to "../target/" for startup files;
- "../target/bin" for program paths as there are no program files in
  current sysroots.

Other minor changes:
- use windows-correct path delimiting;
- enable hexagon-toolchain-linux.c test for windows hosts.
2026-04-03 14:44:19 -05:00
Daniil Dudkin
418ae6c600
[include-cleaner][NFC] expose and test normalizePath helper (#189364)
Also fix a bug where the root `/` path would become an empty string.
2026-04-03 19:34:07 +00:00
Arthur Eubanks
88f6b181b6
[gn build] Port commits (#190392)
0cecacd971a5
2cff995e91c3
34ec1870ae46
54e5803d0231
64b728128df3
76ed0ad3577e
d95292f67b48
2026-04-03 12:29:38 -07:00
vporpo
94545a7c63
[SandboxVec][Legality][NFC] Outline differentBlock() and areUnique() (#190024)
And reuse them in LoadStoreVec.
2026-04-03 12:14:55 -07:00
Amr Hesham
a4632f6294
[Clang][Sema] Prevent implicit casting Complex type to Vector (#187954)
Emitting an error message in case of implicit casting of a complex type
to a built-in vector type in C

Fixes: #186805
2026-04-03 21:10:58 +02:00
Tom Tromey
8d34545792
Introduce and use Verifier::visitDIType (#189067)
This adds a new method Verifier::visitDIType, and then changes method
for subclasses of DIType to call it. The new method just dispatches to
DIScope and adds a file/line check inspired by
Verifier::visitDISubprogram.
2026-04-03 12:40:37 -06:00
Wei Wang
f33e9faa5d
[SampleProfile] Fix FuncMappings key mismatch for renamed functions in stale profile matching (#187899)
Fix a bug where `distributeIRToProfileLocationMap` fails to find
location mappings from IR to profile for renamed functions because
`FuncMappings` is indexed by the IR function name while
`distributeIRToProfileLocationMap` looks up by the profile function
name. Fixed by making `FuncMappings` to use profile function name as
key.
2026-04-03 11:38:51 -07:00
Sergei Barannikov
85fb6ba2b7
[lldb][Utility] Remove address size from Stream class (NFC) (#190375)
It violates abstraction. Luckily, it was used only in two places, see
DumpDataExtractor.cpp and CommandObjectMemory.cpp.
2026-04-03 21:36:52 +03:00
Paul Kirth
4ad1844304
[clang-doc] Refactor FriendInfo parameters to use ArrayRef (#190047)
This also adapts readBlock for the new layouts.
2026-04-03 11:26:12 -07:00
Jonas Devlieghere
b8ea714224
[lldb] Fix formatting in ModuleList (NFC) (#190382)
I had auto-merge enabled in #189444 and since the formatter is
non-blocking it got merged despite the issue. Given I'm already here, I
just formatted the whole file.
2026-04-03 18:24:50 +00:00
Kewen Meng
f29d23844c
[Buildbot][AMDGPU] Adapt to recent CMake change (#190381)
Make changes to adapt to
https://github.com/llvm/llvm-project/pull/190349
2026-04-03 18:15:44 +00:00
Björn Svensson
6111520043
[clang-tidy] Fix readability-identifier-naming for C++17 structured bindings (#189500)
`BindingDecl` nodes, i.e. the individual names in a structured binding,
were not handled in `IdentifierNamingCheck::findStyleKind()`, causing
them to fall through to the Default style or be silently ignored.
This led to incorrect renames, e.g. applying member variable conventions
to local bindings.

---------

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
2026-04-03 21:11:18 +03:00
Simon Pilgrim
6832709dc0
[DAG] SDPatternMatch - rename m_Opc -> m_SpecificOpc (#190215)
Match naming convention for other m_Specific* matchers, and frees up the
m_Opc() matcher for future use in #84940 to allow us to capture the
opcode of a unknown binop

Moving to m_SpecificOpc does mess up the formatting in a few places,
I've tried to refactor to use the m_Value(SDValue, ....) matcher where I
can to retrieve some whitespace
2026-04-03 18:03:00 +00:00
Andy Kaylor
68b6a27771
[CIR] Use destination type when emitting constant function ptrs (#189741)
This updates the CIR constant emitter to use the correct destination
type when emitting a constant initializer for a structure that might be
initialized with non-prototyped function pointers. We were previously
using the type from whatever function declaration we had, but this may
not be the correct type.

This change also updates the `replaceUsesOfNonProtoTypeWithRealFunction`
to ignore global initializer uses, which do not need to be updated after
this change.
2026-04-03 10:58:46 -07:00
Md Abdullah Shahneous Bari
ffd29734cc
[mlir][gpu] Extend mgpumoduleLoadJIT API to add assemblySize parameter (#189429)
When JITing SPIR-V using LevelZero API, it expects the length of the
string since passed input data is a `void *`. Problem is, getting the
length of the string is not possible using something like
`strlen(reinterpret_cast<char *>(data))` in `mgpuModuleLoadJIT`
implementation. Becasuse the SPIR-V binary contains null bytes (i.e.,
the data is binary SPIR-V, not null-terminated text).

As a result we need to pass the `assmeblySize` via the
`mgpuModuleLoadJIT(void* data, int optLevel, size_t assmeblySize)`.
2026-04-03 12:45:40 -05:00
Henrich Lauko
f26b30ea35
[CIR] Auto-generate matchAndRewrite for one-to-one CIR-to-LLVM lowerings (#190326)
When a CIR op specifies a non-empty `llvmOp` field, the lowering
emitter now generates the `matchAndRewrite` body that converts the
result type and forwards all operands to the corresponding LLVM op.
This removes 27 boilerplate lowering patterns from LowerToLLVM.cpp.

Ops needing custom logic (FMaxNumOp/FMinNumOp for FastmathFlags::nsz)
override `llvmOp = ""` to retain hand-written implementations.

Also fixes llvmOp names (TruncOp -> FTruncOp, FloorOp -> FFloorOp)
and adds a diagnostic rejecting conflicting llvmOp + custom constructor.
2026-04-03 19:29:03 +02:00
Amr Hesham
2108252f0e
[clang] Fixed a crash when explicitly casting to atomic complex (#172163)
Fixed a crash when explicitly casting a scalar to an atomic complex.

resolve: #114885
2026-04-03 19:28:20 +02:00
Valeriy Savchenko
853ea940ae
[InstCombine][NFC] Expose isKnownExactCastIntToFP as a public method (#190327) 2026-04-03 18:15:49 +01:00
Henrich Lauko
dec90ffbc9
[CIR] Fix record layout for [[no_unique_address]] fields (#186701)
Fix two bugs in CIR's handling of `[[no_unique_address]]` fields:

- Record layout: Use the base subobject type (without tail padding)
instead of the complete object type for [[no_unique_address]] fields,
allowing subsequent fields to overlap with tail padding.
- Field access: Insert bitcasts from the base subobject pointer to the
complete object pointer after cir.get_member for potentially-overlapping
fields, so downstream code sees the expected type.
- Zero-sized fields: Handle truly empty [[no_unique_address]] fields by
computing their address via byte offsets rather than cir.get_member,
since they have no entry in the record layout.

A known gap (CIR copies 8 bytes where OG copies 5 via
`ConstructorMemcpyizer`) is noted for follow-up.
2026-04-03 19:07:25 +02:00
Jonas Devlieghere
271a08889b
[lldb] Load scripts from code signed dSYM bundles (#189444)
LLDB automatically discovers, but doesn't automatically load, scripts in
the dSYM bundle. This is to prevent running untrusted code. Users can
choose to import the script manually or toggle a global setting to
override this policy. This isn't a great user experience: the former
quickly becomes tedious and the latter leads to decreased security.

This PR offers a middle ground that allows LLDB to automatically load
scripts from trusted dSYM bundles. Trusted here means that the bundle
was signed with a certificate trusted by the system. This can be a
locally created certificate (but not an ad-hoc certificate) or a
certificate from a trusted vendor.
2026-04-03 17:04:47 +00:00
Rafael Auler
7da3a66c06
[BOLT] Check for write errors before keeping output file (#190359)
Summary:
When the disk runs out of space during output file writing, BOLT would
crash with SIGSEGV/SIGABRT because raw_fd_ostream silently records write
errors and only reports them via abort() in its destructor. This made it
difficult to distinguish real BOLT bugs from infrastructure issues in
production monitoring.

Add an explicit error check on the output stream before calling
Out->keep(), so BOLT exits cleanly with exit code 1 and a clear error
message instead.

Test: manually verified with a full filesystem that BOLT now prints
"BOLT-ERROR: failed to write output file: No space left on device" and
exits with code 1.
2026-04-03 10:02:36 -07:00
Osman Yasar
150042141c
[GlobalISel] Add sub(-1, x) -> (xor x, -1) from SelectionDAG (#181014)
This PR adds the pattern `// (sub -1, x) -> (xor x, -1)` to GlobalISel
from SelectionDAG.

Original SelectionDAG rewrite:
5b4811eddb/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (L4305)

---------

Co-authored-by: Jay Foad <jay.foad@gmail.com>
2026-04-03 17:53:30 +01:00
vangthao95
df1e67b379
AMDGPU/GlobalISel: RegBankLegalize rules for s_memtime, s_get_waveid (#190268) 2026-04-03 09:46:56 -07:00
Sander de Smalen
730a07f225
[LV] Only create partial reductions when profitable. (#181706)
We want the LV cost-model to make the best possible decision of VF and
whether or not to use partial reductions. At the moment, when the LV can
use partial reductions for a given VF range, it assumes those are always
preferred. After transforming the plan to use partial reductions, it
then chooses the most profitable VF. It is possible for a different VF
to have been more profitable, if it wouldn't have chosen to use partial
reductions.

This PR changes that, to first decide whether partial reductions are
more profitable for a given chain. If not, then it won't do the
transform.

This causes some regressions for AArch64 which are addressed in a
follow-up PR to keep this one simple.
2026-04-03 17:42:51 +01:00
Ryotaro Kasuga
85e2a36501
[DA] Remove dead code from the Weak Crossing SIV test (#190355)
The ConstantRange intersection check can now handle cases where the
condition of this branch is satisfied. The check is performed before
entering this function, so this part is no longer necessary.
2026-04-03 16:30:42 +00:00
Jan Svoboda
7f9e4fe708
[clang] Extract in-memory module cache writes from ASTWriter (#190062)
This PR extracts the write to the in-memory module cache from within
`ASTWriter` into `CompilerInstance.` This brings it closer to other
module cache manipulations, making the ordering much more clear and
explicit.
2026-04-03 09:18:33 -07:00
Artemiy
dc83ad2b37
[CIR] Fix incorrect CIR_GlobalOp.global_visibility assembly format (#189673)
Closes #189666 .

Fix incorrect printing and parsing of `cir.global` if
`global_visibility` attribute is present. Incorrect assembly format
```
(`` $global_visibility^)?
```

Resulted in keyword sticking to previous word and producing incorrect
cir like this:
```
cir.globalhidden external dso_local @hidden_var = #cir.int<10> : !s32i {alignment = 4 : i64} loc(#loc22)
cir.global "private"hidden internal dso_local @hidden_static_var = #cir.int<10> : !s32i {alignment = 4 : i64} loc(#loc24)
```

Using custom parser/printer that is used in `cir.func` parser fixes this
issue and makes printed/parsed attribute for functions and global values
consistent.

Also added tests for both global values and functions.
2026-04-03 09:17:44 -07:00
Jonas Devlieghere
fd68fa98fc
[lldb] Remove unnecessary calls to ConstString::AsCString (NFC) (#190298)
Replace calls to `ConstString::AsCString` with
`ConstString::GetString(Ref)` where appropriate.

Assisted-by: Claude Code
2026-04-03 16:11:23 +00:00
Florian Hahn
7edf8a7b51
[SCEV] Replace some hasFlags calls with hasNo(Un)SignedWrap (NFC). (#190352)
This is slightly more compact and reduces diff when switching to enum
class (https://github.com/llvm/llvm-project/pull/190199).

PR: https://github.com/llvm/llvm-project/pull/190352
2026-04-03 16:09:40 +00:00
Joseph Huber
d8ba56ce3f
[compiler-rt] Split the GPU.cmake cache file to AMDGPU and NVPTX (#190349)
Summary:
These will have different functionality going forward. They should be
split so we can more easily support things only feasible in AMDGPU.
2026-04-03 10:44:04 -05:00
Andy Kaylor
641276751d
[CIR] Fix mixing of catch-all and type-specific catch handlers (#190285)
If a try block has a catch-all handler and one or more type-specific
catch handlers, we were failing to generate the null type specifier when
lowering from CIR to LLVM IR. This change fixes that problem.

Assisted-by: Cursor / claude-4.6-opus-high
2026-04-03 08:38:55 -07:00
Andy Kaylor
5b56352757
[CIR] Implement cleanups for temporaries with automatic duration (#189754)
This implements handling for cleanup of temporary variables with
automatic storage duration. This is a simplified implementation that
doesn't yet handle the possibility of exceptions being thrown within
this cleanup scope or the cleanup scope being inside a conditional
operation. Support for those cases will be added later.
2026-04-03 08:38:06 -07:00
Sander de Smalen
62bbe3fffc
Fix buildbot failure by explicitly disabling partial reductions in TTI. (#190165)
Partial reductions were previously disabled by default, but by
implementing a generic cost-model in BasicTTIImpl (#189905) this now
accidentally enables the use of those when vectorising loops for targets
that may not support this yet.
2026-04-03 16:33:39 +01:00
Joseph Huber
1484e0f16a
[libc] Use CMAKE_CROSSCOMPILING_EMULATOR instead searching for `llvm-gpu-loader' (#189417)
Summary:
We already handle this with other targets, we should be able to unify
the handling here.
2026-04-03 09:58:04 -05:00
Erich Keane
11d65dc8c2
Revert "[CIR][NFC] Add NYI for OMPSplitDirective stmt" (#190346)
Reverts llvm/llvm-project#190329

The patch this depends on got reverted.
2026-04-03 14:40:42 +00:00
Craig Topper
5d08beaec8
[TargetLowering] Remove NeedToApplyOffset from prepareSREMEqFold. NFC (#190256)
For a given element, I believe A is only 0 when the divisor is INT_MIN.
The only way for NeedToApplyOffset to be false after processing all
elements, is for all divisors to be INT_MIN. If all divisors are
INT_MIN, then all divisors are a power of 2 and we wouldn't do the
transform.
2026-04-03 07:32:13 -07:00
Matt Arsenault
34ec1870ae
clang/AMDGPU: Refactor triple adjustments (#190343)
Factor this similar to the ARM case for future
expansion. The difference being -mcpu is treated as
an alias for -mcpu instead of something separately
useful.

I don't understand this mutation of the triple into
spirv64. The only test where this appears to matter
does not use -mcpu. Previously this would only match
for -mcpu, but this would change the behavior to prefer
-march before falling back to -mcpu.
2026-04-03 16:17:34 +02:00