575391 Commits

Author SHA1 Message Date
Fangrui Song
2f7bd4fa97
[ELF] Enable parallel relocation scanning for -z nocombreloc and PPC64 (#190309)
The `bool serial` condition in scanRelocations disabled parallelism for
three cases: -z nocombreloc, MIPS, and PPC64. Resolve two cases:

- nocombreloc: .rela.dyn is now always created with combreloc=true so
  non-relative relocations are sorted deterministically. Since
  #187964 already separates relative relocations unconditionally,
  the only remaining effect of -z nocombreloc is suppressing
  DT_RELACOUNT (gated on ctx.arg.zCombreloc in DynamicSection).

- PPC64: After #181496 moved scanning into scanSectionImpl, the
  sole thread-unsafe access is ctx.ppc64noTocRelax (DenseSet::insert).
  Protect it with ctx.relocMutex, which is already used for rare
  operations during parallel scanning.

MIPS retains serial scanning due to `MipsGotSection` mutations.
2026-04-02 22:00:15 -07:00
Weibo He
bc11c85b6b
[clang][CodeGen] Emit coro.dead intrinsic to improve coroutine allocation elision (#190295)
Part 4/4: Implement HALO for coroutines that flow off final suspend.
Parent PR: #185336
2026-04-03 02:06:10 +00:00
Jackson Stogel
8b903fe38b
[clang][DebugInfo][test] Set -fuse-lld for test matching linker invocation. (#190291)
This test doesn't work as intended when an alternative default linker is
specified via `-DCLANG_DEFAULT_LINKER=ld`. If this test isn't intended
to support alternate default linker, lmk I can just change the
downstream usage I'm seeing, though I figure other folks may have
similar configurations. Repro:

```
cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS="clang" -DCLANG_DEFAULT_LINKER=ld -GNinja
ninja -C build
./build/bin/llvm-lit -v clang/test/DebugInfo/CXX/hotpatch.cpp

...

possible intended match
# |             6:  "/usr/bin/ld" "-out:hotpatch.exe" "-libpath:lib/amd64" "-libpath:atlmfc/lib/amd64" "-nologo" "-functionpadmin" "/tmp/lit-tmp-o7x0r1o_/hotpatch-4595de.obj" 
```

afaict it passed before because `-mincremental-linker-compatible` was
being used until e97a42d5f9fe51de50aabd4d9bf6874a4955f9fa, which would
match on the compilation line.
2026-04-02 19:03:27 -07:00
Tamir Duberstein
72b00e60b8
[CMake] Version Darwin dylib identities (#189004) 2026-04-02 18:35:50 -07:00
Stanislav Mekhanoshin
7084f18f27
[AMDGPU] Fix i16/i8 flat store in true16 with sramecc (#190238)
The pattern was guarded by the D16PreservesUnusedBits predicate
which is not needed for stores.
2026-04-02 17:32:50 -07:00
Peter Collingbourne
935f21e1d5
gn build: Port d8e9e0af1cb6
Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/190290
2026-04-02 17:13:02 -07:00
Peter Collingbourne
f20b40ef97
gn build: Port f63d33da0a51 more
Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/190289
2026-04-02 17:08:29 -07:00
Benjamin Maxwell
89f31f26c8
[AArch64][SME] Preserve ZA in agnostic ZA functions without +sme (#190141)
`__arm_agnostic("sme_za_state")` does not require +sme, but we must
still preserve ZA in case the function is used with code that makes use
of ZA:

> The use of `__arm_agnostic("sme_za_state")` allows writing functions
> that are compatible with ZA state without having to share ZA state
> with the caller, as required by `__arm_preserves`. The use of this
> attribute does not imply that SME is available.
2026-04-03 00:33:28 +01:00
Jason Molenda
124b0a8fbb
[lldb][kernel debug] Add a missing call to scan local fs for kexts (#190281)
A kernel developer noticed that I missed a call to index the local
filesystem in one of our codepaths, and had a use case that depended on
that working.

rdar://173814556
2026-04-02 16:33:00 -07:00
Michael Kruse
1f75f318ae
[Runtimes] Gracefully handle invalid LLVM_TARGET_TRIPLE (#190284)
In some situations such as reported at
https://github.com/llvm/llvm-project/pull/177953#issuecomment-4179014239,
LLVM_(DEFAULT_)TARGET_TRIPLE is not set. It is used to derive the output
directory in #177953. Only flang-rt currently uses
RUNTIMES_(INSTALL|OUTPUT)_RESOURCE_LIB_PATH, we should not fail building
other despite a missing LLVM_TARGET_TRIPLE.

Compiler-rt uses COMPILER_RT_DEFAULT_TARGET_TRIPLE instead which it
derives itself. Most other LLVM runtimes libraries just skip the target
portion of the library path (explicitly so since #93354). Do the same
for RUNTIMES_(INSTALL|OUTPUT)_RESOURCE_LIB_PATH which we hope eventually
can replace the other mechanisms.
2026-04-02 23:32:42 +00:00
Paul Kirth
2600533a66
[clang-doc] Switch to string internment (#190044)
This is the first step in migrating all the Info types to be POD. We
introduced a shared string saver that can be used safely across threads,
and updated the internal represntation of various data types to use
these over owned strings, like SmallString or std::string.

This also required changes to YAMLGenerator to keep the single quoted
string formatting and to update the YAML traits.

This change gives an almost 50% reduction in peak memory when building
documentation for clang, at about a 10% performance loss. Future patches
can mitigate the performance penalties, and further reduce memory use.

| Metric | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| Time | 920.5s | 920.5s | 1011.0s | +9.8% | +9.8% |
| Memory | 86.0G | 86.0G | 44.9G | -47.8% | -47.8% |

| Benchmark | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| BM_BitcodeReader_Scale/10 | 67.9us | 67.9us | 70.0us | +3.0% | +3.0% |
| BM_BitcodeReader_Scale/10000 | 70.5ms | 70.5ms | 21.3ms | -69.8% |
-69.8% |
| BM_BitcodeReader_Scale/4096 | 23.2ms | 23.2ms | 4.5ms | -80.7% |
-80.7% |
| BM_BitcodeReader_Scale/512 | 509.4us | 509.4us | 538.8us | +5.8% |
+5.8% |
| BM_BitcodeReader_Scale/64 | 114.8us | 114.8us | 118.0us | +2.8% |
+2.8% |
| BM_Index_Insertion/10 | 2.3us | 2.3us | 4.0us | +71.6% | +71.6% |
| BM_Index_Insertion/10000 | 3.1ms | 3.1ms | 5.0ms | +60.6% | +60.6% |
| BM_Index_Insertion/4096 | 1.3ms | 1.3ms | 2.0ms | +57.1% | +57.1% |
| BM_Index_Insertion/512 | 153.6us | 153.6us | 245.0us | +59.6% | +59.6%
|
| BM_Index_Insertion/64 | 18.1us | 18.1us | 28.9us | +60.0% | +60.0% |
| BM_JSONGenerator_Scale/10 | 36.8us | 36.8us | 36.4us | -1.3% | -1.3% |
| BM_Mapper_Scale/10000 | 104.3ms | 104.3ms | 105.4ms | +1.0% | +1.0% |
| BM_Mapper_Scale/512 | 7.6ms | 7.6ms | 7.7ms | +1.9% | +1.9% |
| BM_MergeInfos_Scale/10000 | 12.2ms | 12.2ms | 1.4ms | -88.2% | -88.2%
|
| BM_MergeInfos_Scale/2 | 1.9us | 1.9us | 1.7us | -10.3% | -10.3% |
| BM_MergeInfos_Scale/4096 | 2.8ms | 2.8ms | 495.6us | -82.2% | -82.2% |
| BM_MergeInfos_Scale/512 | 68.9us | 68.9us | 34.6us | -49.7% | -49.7% |
| BM_MergeInfos_Scale/64 | 10.3us | 10.3us | 6.0us | -41.6% | -41.6% |
| BM_MergeInfos_Scale/8 | 2.8us | 2.8us | 2.1us | -24.4% | -24.4% |
| BM_SerializeFunctionInfo | 25.5us | 25.5us | 26.8us | +4.9% | +4.9% |

note: I used an LLM to help generate the test code adjustments and the
YAML traits.
2026-04-02 23:25:21 +00:00
hjagasiaAMD
a76750e6de
Revert "[SimplifyCFG] Extend jump-threading to allow live local defs … (#190269)
…(#135079)"

This reverts commit a757f23404c594f4a48b4ddb6625f88b349d11d5. Commit
causes reduce.cu file in hipcub/warp go from 2 minutes of compilation to
taking several hours.
2026-04-02 23:05:26 +00:00
Jackson Stogel
9d18702cd8
[Bazel] Port b1ef47f45966f06f263dc96d83c869393952cbf8 (#190278) 2026-04-02 16:01:55 -07:00
Dave Lee
8fa4b3d601
[lldb] Simplify some tests to run_to_source_breakpoint (NFC) (#190082)
Many tests have ad hoc forms of the launch & break steps done by
`lldbutil.run_to_source_breakpoint`. This changes some of those tests to
use `run_to_source_breakpoint` instead.

Assisted-by: claude
2026-04-02 15:20:49 -07:00
Andy Kaylor
6c4149dba7
[CIR] Fix handling of catch-all with cleanups (#190233)
We had a bug where exceptions caught with catch-all were not properly
handling a thrown exception if the catch-all handler enclosed a cleanup
handler. The structured CIR was generated correctly, but when we
flattened the CFG and introduced cir.eh.initiate operations, the
cir.eh.initiate for the cleanup's EH path was incorrectly marked as
cleanup-only, even though it chained to the dispatch for the catch-all
handler. This resulted in the landing pad generated for the cleanup not
being marked as having a catch-all handler, so the exception was not
caught.

This change fixes the problem in the FlattenCFG pass.

Assisted-by: Cursor / claude-4.6-opus-high
2026-04-02 15:02:05 -07:00
forking-google-bazel-bot[bot]
842464e7a9
[Bazel] Fixes 71122d8 (#190264)
This fixes 71122d8694cad3ae4450368be3e89bb62aa78173.

Co-authored-by: Google Bazel Bot <google-bazel-bot@google.com>
2026-04-02 14:44:01 -07:00
Deric C.
72cc5a670e
[HLSL] Add TableGen-generated header files to the HLSL distribution (#190222)
This PR adds the TableGen-generated headers from
https://github.com/llvm/llvm-project/pull/187610 to the HLSL
distribution.

Currently the HLSL distribution is incomplete due to missing these
generated headers, preventing successful compilation:
```
Command Output (stderr):
--
In file included from <built-in>:1:

In file included from D:\a\_work\1\ClangHLSL\Binaries\lib\clang\23\include\hlsl.h:24:

D:\a\_work\1\ClangHLSL\Binaries\lib\clang\23\include\hlsl/hlsl_alias_intrinsics.h:42:10: fatal error: 'hlsl_alias_intrinsics_gen.inc' file not found

   42 | #include "hlsl_alias_intrinsics_gen.inc"

      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.
```
This PR fixes the error by including `hlsl_alias_intrinsics_gen.inc` and
`hlsl_inline_intrinsics_gen.inc` in the HLSL distribution.
2026-04-02 14:38:58 -07:00
Michael Spencer
b1ef47f459
[libclang] Add clang_ModuleCache_prune (#190067)
This allows a build system to direct Clang to prune a module cache
directory using the same method Clang does internally.

This also changes `clang::maybePruneImpl` to clean up files directly in
the directory, not just subdirectories.
2026-04-02 14:26:27 -07:00
David Green
bf50e847fb
[AArch64] Add tests for st1 from subvector extracts. NFC (#190265) 2026-04-02 22:20:53 +01:00
Roland McGrath
71122d8694
[libc] Move LLVM_LIBC_IS_DEFINED macro to its own header (#190081)
This moves the LLVM_LIBC_IS_DEFINED macro to its own header is
__support/macros.  Its implementation leverages cpp::string_view
instead of rolling its own strcmp; this necessitated fixing
several missing constexpr in the string_view implementation.

The new __support/macros/macro-utils.h is also broken out to hold
the stringification macro and can be used in future for token
pasting shenanigans and other such generic macro machinery.
2026-04-02 14:13:51 -07:00
Jan Svoboda
c0cfe546a1
[clang] Include header providing off_t (#190259)
This should fix the modules build.
2026-04-02 21:02:41 +00:00
NeKon69
5669dfc68b
[LifetimeSafety] Propagate loans through pointer arithmetic (#189546)
This PR adds loan propagation for pointer arithmetic.

It also updates the tests to match the new behavior.

Fixes #180933
2026-04-02 21:59:39 +01:00
Matt Arsenault
d34e84700a
clang: Use MakeArgStringRef more often (#189463)
Avoid an intermediate copy by using MakeArgStringRef. Also
use better use of Twine with MakeArgString.
2026-04-02 20:56:56 +00:00
Amr Hesham
f2dff15995
[clang] Fixed a crash when explicitly casting between atomic complex types (#172210)
Fixed a crash when explicitly casting between atomic complex types

resolve: #172208
2026-04-02 22:55:43 +02:00
Victor Chernyakin
a413a40150
[clang-tidy][NFC] Remove another ad-hoc exclusion for system headers (#190094)
This is another ad-hoc approach made obsolete by #151035.
2026-04-02 20:52:47 +00:00
Andy Kaylor
7d2f2a3f4d
[CIR] Fix off-by-one dtor loop bug (#190242)
We had an off-by-one error in the CIR generation for array destructor
loops, causing us to miss destructing one element of the array. This
change fixes the problem.
2026-04-02 13:49:19 -07:00
Sirish Pande
dbde0ba150
[AMDGPU] Rename 1_5xVGPRs to 1536VGPRs to be more contextual. NFC (#190245)
Renaming feature from 1_5xVGPRs to 1536VGPRs to to be more contextual.
2026-04-02 15:35:13 -05:00
Stanislav Mekhanoshin
3fc4d44816
[AMDGPU] Update gfx1250_dasm_vop3cx.txt test for true16. NFC (#190240) 2026-04-02 13:29:59 -07:00
Matt Arsenault
2f9ac44061
clang: Reorder linker aux-triple handling (#189462)
Move the IsCuda check out from the IsCuda || isHIP block. Keep
this from splitting the aux-triple handling for future convenience.
2026-04-02 22:23:28 +02:00
Matt Arsenault
eed1f2749d
libclc: Use special division for atan2 for DAZ (#190248)
The AMDGPU DAZ fdiv works fine in this case, so there's
maybe something better we could do here.
2026-04-02 22:18:17 +02:00
Eli Friedman
45ac2db4e5
[clang][NFC] Clean up InitializedEntity booleans. (#185335)
As discussed in #182203, use enums instead.

I tried to name/use them appropriately, but I'm not sure sure I'm really
happy with the results; suggestions welcome.
2026-04-02 13:11:55 -07:00
Valeriy Savchenko
75a354ba55
[InstCombine] Use ComputeNumSignBits in isKnownExactCastIntToFP (#190235)
For signed int-to-FP casts, ComputeNumSignBits can prove exactness where
computeKnownBits cannot -- e.g. through ashr(shl x, a), b where sign propagation is
tracked precisely but individual known bits are all unknown.
2026-04-02 21:04:29 +01:00
Karthik Senthil
148cb22dd7
[NVPTX] Fix missing arch version for ptxas in LIT test. (#190231)
Recently added LIT test in #188539 missed -arch option for ptxas causing
post commit build failure. This PR addresses that failure.
2026-04-02 13:02:29 -07:00
Joseph Huber
b2d3a6574c
[libc] Rename rpc::Status to rpc::RPCStatus to reduce conflicts (#190239)
Summary:
`Status` is unfortunately heavily overloaded in practice. Things like
X11 define it as a macro. Best to just remove that possibility entirely.
2026-04-02 14:55:57 -05:00
xys-syx
1474e3e4f4
[MLIR][NVVM] Derive NVVM_SyncWarpOp from NVVM_IntrOp for import support (#188415)
Change `NVVM_SyncWarpOp` base class from `NVVM_Op` to
`NVVM_IntrOp<"bar.warp.sync">`, which auto-generates `llvmEnumName =
nvvm_bar_warp_sync` and registers it with
`-gen-intr-from-llvmir-conversions` and
`-gen-convertible-llvmir-intrinsics`. This enables LLVM IR to MLIR
import. The hand-written `llvmBuilder` is removed as the default
`LLVM_IntrOpBase` builder is equivalent.
2026-04-02 15:41:50 -04:00
Matt Arsenault
a68ae7b0cc
DiagnosticInfo: Use Twine for resource name (#190228)
Allow more flexibility in phrasing of the overallocated
resource.
2026-04-02 21:41:38 +02:00
Rahul Joshi
43a8b7de88
[NFC][LLVM] Rename several ArgsTys arguments to OverloadTys. (#190210)
Rename several arguments to intrinsic related functions from `ArgsTys`
to `OverloadTys` to better reflect their meaning. The only variables
left with name `ArgTys` now actually mean function argument types.

Also reamove an incorrect comment in Intrinsics.td. Dependent types do
allow forward references starting with
7957fc6547
2026-04-02 12:36:28 -07:00
Matt Arsenault
2ec19b86b5
ValueTracking: x - floor(x) cannot introduce overflow (#189003)
This returns a value with an absolute value less than 1 so it
should be possible to propagate no-infs.
2026-04-02 19:26:22 +00:00
Ehsan Amiri
0abef30c80
[DA] Fix warning introduced by #189740 (#190226)
The following warning is issued for llvm/lib/Analysis/DependenceAnalysis.cpp:2004

warning: suggest parentheses around ‘&&’ within ‘||’
2026-04-02 15:15:25 -04:00
Craig Topper
e2e5db8401
[TargetLowering] Speculative fix for a non-determinism issue between different compilers. (#190219)
The evaluation order of function arguments is unspecified by the C++
standard. We had two getNode calls as function arguments which causes
the nodes to be created in a different order depending on the compiler
used. This patch moves them to their own variables to ensure they are
called in the same order on all compilers.

Possible fix for #190148.
2026-04-02 12:12:28 -07:00
Prabhu Rajasekaran
e97a42d5f9
[Driver] UEFI -mno-incremental-linker-compatible (#188800)
The `-mno-incremental-linker-compatible` switch translates to Brepro
linker flag and must be passed on to the underlying linker to match the
behavior of the Windows triples that produce PE COFF.
2026-04-02 19:11:28 +00:00
Bangtian Liu
86b5f11ecc
[mlir][GPU] Add constant address space to GPU dialect (#190211)
This PR adds a `constant` address space to the` GPU dialect and
lowerings to all GPU backends.

Signed-off-by: Bangtian Liu <liubangtian@gmail.com>
2026-04-02 15:02:12 -04:00
Dominik Montada
f7b6cc1efa
[llvm-reduce] Set the target triple before parsing machine functions (#189989)
Make sure that the module has a target triple set before trying to parse
machine functions. This can be required for (downstream) targets if MIR
parsing relies on features guarded by the target triple.
2026-04-02 20:55:45 +02:00
Amr Hesham
fdc54c9a1e
[CIR][NFC] Use RelativeCXXABIVTables after isRelativeLayout is removed (#190229)
Update the ClangIR side after changes related to removing
isRelativeLayout and using RelativeCXXABIVTables directly from #139315
2026-04-02 18:48:19 +00:00
Tamir Duberstein
4642a6183d
[CMake] Extract Mach-O version helper (#190225)
Use CMake's native MACHO_COMPATIBILITY_VERSION and MACHO_CURRENT_VERSION
properties rather than manually pass linker flags. These properties are
available since CMake 3.17.0, released in 2020.
2026-04-02 18:48:01 +00:00
Tamir Duberstein
533d0ac216
[CMake] Group SOVERSION logic (#190224)
There are two blocks whose conditions are coupled; combine them to make
the conditional logic less error prone.
2026-04-02 18:36:59 +00:00
Steven Perron
6331bfa41a
[HLSL] Add GetDimensions to Texture2D. (#189991)
This commit add the GetDimensions methods to Texture2D. For DXIL, it
requires intrinsics that are not yet available. They are added, but not
implemented.

Assisted-by: Gemini

Co-authored-by: Helena Kotas <hekotas@microsoft.com>
2026-04-02 18:26:02 +00:00
Alex Langford
e0e439ce9f
[lldb] Remove libc++ category from TestNavigateHiddenFrame.py (#190016)
This test technically does not require libc++. The test binary mimics
libc++'s namespace layout to trigger some frame hiding logic in lldb,
but it does not require libc++ to function.
2026-04-02 11:12:47 -07:00
Alex Langford
343210656c
[lldb] Standardize TestVectorOfEnums.py as a C++ data formatter test (#189757)
This is explicitly marked as a libc++ test and functionally tests the
formatter for a vector of enums. I put it in the generic directory
because there's no reason this couldn't work for other c++ stdlibs.

Additionally, this should be using the custom libc++ like the other
tests.
2026-04-02 11:12:00 -07:00
Ramkumar Ramachandra
d0e265f20d
[VPlan] Cleanup and generalize VPIRMetadata CastInfo (NFC) (#190162)
Similar to b0230f59 ([VPlan] Cleanup and generalize VPPhiAccessors
CastInfo, #190027).
2026-04-02 19:00:23 +01:00