570284 Commits

Author SHA1 Message Date
Jason Molenda
3f024d0835
[lldb] A few small code modernizations and cleanups [NFC] (#182656)
I was reading through ObjectContainerBSDArchive and came across some
dead method decls, a less-than-completely-clear `shared_ptr` typedef in
`ObjectContainerBSDArchive::Archive` for a shared_ptr<Archive> which was
a little unclear when reading a decl like `shared_ptr archive_sp;` for a
local variable.
2026-02-23 22:03:40 -08:00
Karthika Devi C
6654737d9a
[AArch64] Optimize 64-bit constant vector builds (#177076)
This patch optimizes the creation of constant 64-bit vectors (e.g.,
v2i32, v4i16) by avoiding expensive loads from the constant pool. The
optimization works by packing the constant vector elements into a single
i64 immediate and bitcasting the result to the target vector type. This
replaces a memory access with more efficient immediate materialization.
To ensure this transformation is efficient, a check is performed to
verify that the immediate can be generated in two or fewer mov
instructions. If it requires more, the compiler falls back to using the
constant pool.
The optimization is disabled for bigendian targets for now.
2026-02-24 11:12:04 +05:30
Jonas Devlieghere
863813cace
[lldb] Merge interfaces into lldbPluginScriptInterpreterPython (NFC) (#182962)
Make the interfaces part of lldbPluginScriptInterpreterPython instead of
putting them into their own static library. This avoids the need for an
extra static archive and more importantly a bunch of code duplication
between the two CMakeLists.txt.
2026-02-23 21:33:38 -08:00
Rana Pratap Reddy
bf3ac05ed2
[Clang][AMDGPU] Change __fp16 to _Float16 in GFX1250 CVT builtin definitions (#182893)
Change the type signature `gfx1250 cvt` builtins from `__fp16` to
`_Float16` in the tablegen builtin definitions.
2026-02-24 10:46:12 +05:30
Shivam Kunwar
a96daba840
[DWARFLinker] Fix buildbot crash: NewUnit can be null during garbage (#182993)
The assert added in
[0ab1d23fbfa2ae0ba14315cb11678d2289510f66](0ab1d23fbf)
is incorrect, NewUnit is legitimately null for compile units that are
skipped during garbage collection (e.g. dwarf5-macro.test). Revert to
the original null check.
2026-02-24 10:26:36 +05:30
Akimasa Watanuki
762ad00007
[mlir][gpu] Validate gpu-module-to-binary format (#182842)
`GpuModuleToBinaryPass::runOnOperation` now treats an unsupported
`format` value as a pass failure after emitting `"Invalid format
specified."`.

Add a regression test in
`mlir/test/Dialect/GPU/module-to-binary-invalid-format.mlir`.

Fix: https://github.com/llvm/llvm-project/issues/77052
Fix: https://github.com/llvm/llvm-project/issues/116344
Fix: https://github.com/llvm/llvm-project/issues/116346
Fix: https://github.com/llvm/llvm-project/issues/116352
2026-02-24 13:54:59 +09:00
Brandon Wu
03bb370602
[RISCV][llvm] Rename zvqdotq to zvdot4a8i (#179393)
The renaming PR is here:
https://github.com/riscv/riscv-isa-manual/pull/2576
Note that this also update the version number.
2026-02-24 04:44:07 +00:00
Timm Baeder
d44e957d14
[clang][AST] Make ASTContext::InterpContext mutable (#182884)
Do the `const_cast` only once, in `ASTContext::getInterpContext()`.
2026-02-24 05:37:41 +01:00
Shivam Kunwar
0ab1d23fbf
[DWARFLinker] Use DIEEntry for backward ref_addr references (#181881)
The classic DWARF linker avoids `DIEEntry` for `DW_FORM_ref_addr`
references, using raw `DIEInteger` values with manual offset computation
instead. A stale FIXME explains this was because "the implementation
calls back to DwarfDebug to find the unit offset", but this is no longer
true. `DIEEntry` resolves offsets via
`DIEUnit::getDebugSectionOffset()`, which has no `DwarfDebug`
dependency.


And the real constraint is that forward references may point to
placeholder `DIEs` that never get adopted into a unit tree (due toODR
pruning), so `DIEEntry` cannot resolve them(a test failed during
refactoring this). However, backward references are safe, the target DIE
is already cloned and parented in a unit tree.
2026-02-24 10:00:57 +05:30
Alexis Engelke
3de98281d4
[MLIR][CMake] Disable PCH reuse for C API libraries (#182862)
C API libraries override the symbol visibility default, which is incompatible with PCH.
2026-02-23 20:16:08 -08:00
Congcong Cai
09ab9a16e2
[MemRefToEmitC] fix typo (#182991) 2026-02-24 04:08:41 +00:00
modiking
d5bf514200
[NVPTX] Scalarize v2f32 instructions if input operand guarantees need for register coalescing (#180113)
The support of f32 packed instructions in #126337 revealed performance
regressions on certain kernels. In one case, the cause comes from
loading a v4f32 from shared memory but then accessing them as {r0, r2}
and {r1, r3} from the full load of {r0, r1, r2, r3}.

This access pattern guarantees the registers requires a coalescing
operation which increases register pressure and degrades performance.
The fix here is to identify if we can prove that an v2f32 operand comes
from non-contiguous vector extracts and if so scalarizes the operation
so the coalescing operation is no longer needed.

I've found that ptxas can see through the extra unpacks/repacks of
contiguous registers this causes in MIR. However in the full test case
the packing of the final scalar->vector results does generate additional
costs especially since the only users unpack them. An additional MIR
pass is possible to catch the case

Assisted-by: Cursor / claude-4.6-opus-high

---------

Co-authored-by: Princeton Ferro <princetonferro@gmail.com>
2026-02-23 19:44:05 -08:00
Aiden Grossman
9b4c99a1e4
[AsmPrinter] Use default capture for assertion only lambda (#182986)
Otherwise we get an unused variable warning/error in non-assertion
builds.
2026-02-24 03:25:37 +00:00
Yaxun (Sam) Liu
1b47242dcd
[CHR] Skip regions containing convergent calls (#180882)
CHR (Control Height Reduction) merges multiple biased branches into a
single speculative check, cloning the region into hot/cold paths. On
GPU targets, the merged branch may be divergent (evaluated per-thread),
splitting the wavefront: some threads take the hot path, others the
cold path.

A convergent call like ds_bpermute (a cross-lane operation on AMDGPU)
requires a specific set of threads to be active — when thread X reads
from thread Y, thread Y must be active and participating in the same
call. After CHR cloning, thread Y may have gone to the cold path while
thread X is on the hot path, so the hot-path ds_bpermute reads a stale
register value from thread Y instead of the intended value.

This caused a miscompilation in rocPRIM's lookback scan: CHR duplicated
a region containing ds_bpermute, and the hot-path copy executed with a
different set of active threads, reading incorrect cross-lane data and
causing a memory access fault.

The fix skips any region containing convergent or noduplicate calls,
following the same pattern as SimplifyCFG's block-duplication guard.
2026-02-23 21:47:43 -05:00
Twice
3b2c1db870
[MLIR][Python] Support type definitions in Python-defined dialects (#182805)
In this PR, we added basic support of type definitions in Python-defined
dialects, including:
- IRDL codegen for type definitions
- Type builders like `MyType.get(..)` and type parameter accessors (e.g.
`my_type.param1`)
- Use Python-defined types in Python-defined oeprations

```python
class TestType(Dialect, name="ext_type"):
    pass

class Array(TestType.Type, name="array"):
    elem_type: IntegerType[32] | IntegerType[64]
    length: IntegerAttr

class MakeArrayOp(TestType.Operation, name="make_array"):
    arr: Result[Array]

class MakeArray3Op(TestType.Operation, name="make_array3"):
    arr: Result[Array[IntegerType[32], IntegerAttr[IntegerType[32], 3]]]
```
2026-02-24 10:34:58 +08:00
hanbeom
ccfd59a03e
[NFC][WebAssembly] Expanding load-ext testcases for the MVP CPU target (#182864)
Some features tested in load-ext require sign-ext. 
To test this, add tests targeting the MVP CPU.
2026-02-24 11:30:51 +09:00
Fangrui Song
13838efa3c
[ELF] Adjust allowed dynamic relocation types for x86-64 (#182905)
First, disallow R_X86_64_PC64 - generally only absolute relocations are
allowed in getDynRel. glibc and musl don't support R_X86_64_PC64 as
dynamic relocations.

Second, support R_X86_64_32 as dynamic relocation for the ILP32 ABI
(x32). GNU ld's behavior looks like:

- R_X86_64_32 => R_X86_64_RELATIVE
- R_X86_64_64 with addend 0 => R_X86_64_RELATIVE
- R_X86_64_64 with non-zero addend => R_X86_64_RELATIVE64 (unsupported
  by musl; compilers do not generate such constructs to the best of my
  knowledge)

For now we require R_X86_64_64 to be resolved at link-time for x32.

Fix #140465
2026-02-23 18:26:56 -08:00
Mohamed Emad
05a039489d
[libc][math] Refactor bf16mul family to header-only (#182018)
Refactors the bf16mul math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182017

Target Functions:
  - bf16mul
  - bf16mulf
  - bf16mulf128
  - bf16mull
2026-02-24 02:24:01 +00:00
Uday Bondhugula
b311c02c2c
[MLIR][Affine] Fix assert in slice compute cost (#182712)
Fixes https://github.com/llvm/llvm-project/issues/180029.
2026-02-24 07:48:37 +05:30
Iñaki V Arrechea
a17a305f05
[LLVM] Metric added - largest number of basic blocks in a single func… (#182970)
This metric gets the size of the biggest count of basic blocks in a
single function.
2026-02-23 18:06:47 -08:00
Aiden Grossman
6b63c59a58
[NewPM][X86] Port AsmPrinter to NewPM
This patch makes AsmPrinter work with the NewPM. We essentially create
three new passes that wrap different parts of AsmPrinter so that we can
separate out doIntialization/doFinalization without needing to
materialize all MachineFunctions at the same time. This has two main
drawbacks for now:

1. We do not transfer any state between the three new AsmPrinter passes.
   This means that debuginfo/CFI currently does not work. This will be
   fixed in future passes by moving this state to MachineModuleInfo.
2. We probably incur some overhead by needing to setup up analysis
   callbacks for every MF rather than just per module. This should not
   be large, and can be optimized in the future on top of this if
   needed.
3. This solution is not really clean. However, a lot of cleanup is going
   to be difficult to do while supporting two pass managers. Once we
   remove LegacyPM support, we can make the code much cleaner and better
   enforce invariants like a lack of state between
   doInitialization/runOnMachineFunction/doFinalization.

Reviewers: arsenm, aeubanks, paperchalice

Pull Request: https://github.com/llvm/llvm-project/pull/182797
2026-02-23 17:28:15 -08:00
Aiden Grossman
25f69d7a3f
[NFCi][NewPM][x86] Use callbacks to get analyses in AsmPrinter
This allows for overriding these call backs when using the NewPM which
has different methods for obtaining analysis results.

Reviewers: RKSimon, arsenm, phoebewang, mingmingl-llvm, aeubanks

Pull Request: https://github.com/llvm/llvm-project/pull/182796
2026-02-23 17:24:39 -08:00
Aiden Grossman
abc443ba0a
[CodeGen][NewPM] Adjust pipeline for AsmPrinter
AsmPrinter needs to be split into three passes (begin, per MF, end) to
avoid the need to materialize all machine functions at the same time.
Update the CodeGenPassBuilder hooks for this.

Reviewers: aeubanks, paperchalice, arsenm

Pull Request: https://github.com/llvm/llvm-project/pull/182795
2026-02-23 17:23:25 -08:00
Aiden Grossman
683d15f810
[CodeGen][NewPM] Plumb MCContext through buildCodeGenPipeline
Otherwise we cannot create an MCStreamer without getting MMI, which we
cannot do until we have started running AsmPrinter without also plumbing
MMI through CodeGenPassBuilder.

Reviewers: arsenm, paperchalice, aeubanks

Pull Request: https://github.com/llvm/llvm-project/pull/182794
2026-02-23 17:21:32 -08:00
Aiden Grossman
757066c95e
[NFCi][AsmPrinter] Refactor getting analyses to callbacks
As part of making AsmPrinter work with the new pass manager, we need to
be able to override how we get analyses. This patch does that by
refactoring getting all analyses/other related functionality to
callbacks that are set by default but can be overriden later (like by a
NewPM wrapper pass).

Reviewers: aeubanks

Pull Request: https://github.com/llvm/llvm-project/pull/182793
2026-02-23 17:17:56 -08:00
Paul Kirth
19daed352f
Revert "[ASan][Fuchsia] Have Fuchsia use a dynamic shadow start" (#182972)
Reverts llvm/llvm-project#180880

This is breaking Fuchsia's CI. something in the CMake needs to be
adjusted. Reverting on the author's request.
2026-02-24 01:00:03 +00:00
Joseph Huber
23302678e8
[HIP] Move HIP to the new driver by default (#123359)
Summary:
This patch matches CUDA, moving the HIP compilation jobs to the new
driver by default. The old behavior will return with
`--no-offload-new-driver`. The main difference is that objects compiled
with the old driver are no longer compatible and will need to be
recompiled or the old driver used.
2026-02-23 18:23:56 -06:00
Iñaki V Arrechea
a8f3c97d3a
Implemented metric that gets biggest function's size (#182632)
This metric gets the size of the biggest function.
2026-02-23 16:06:53 -08:00
PiJoules
9146da3a7b
[ASan][Fuchsia] Have Fuchsia use a dynamic shadow start (#180880)
The dynamic shadow global is still set to zero, but this will change in the future.
2026-02-23 15:49:05 -08:00
Deric C.
4f59da55d7
[HLSL][Matrix] EmitFromMemory when emitting load of vector and matrix element LValues (#178315)
Fixes #177712

The MatrixElt and VectorElt cases of `EmitLoadOfLValue` did not convert
the scalar value from its load/store type into its primary IR type like
the other cases do, which caused issues with HLSL in particular which
requires bools to be converted to and from i32 and i1 forms for its
load/store and primary IR types respectively.

This PR fixes the issue by applying `EmitFromMemory` to the loaded
scalar.
2026-02-23 15:45:35 -08:00
Hansang Bae
a347e1298c
[Offload] Enable memory usage printing with alloc debug type (#182938) 2026-02-23 17:19:41 -06:00
Florian Hahn
6b352aa8ea
Revert "[VPlan] Add simple driver option to run some individual transforms. (#178522)"
This reverts commit 3df1c6f88bfbbd76d9256c55358bb75e02e33779.

Causes build-failures without assertions
https://lab.llvm.org/buildbot/#/builders/159/builds/41683
2026-02-23 22:55:42 +00:00
Daniel Thornburgh
6d37110e09
Revert "RuntimeLibcalls: Fix adding __safestack_pointer_address by default" (#182949)
Reverts llvm/llvm-project#182936
2026-02-23 22:52:55 +00:00
Florian Hahn
3df1c6f88b
[VPlan] Add simple driver option to run some individual transforms. (#178522)
Add an alternative to test VPlan in more isolation via a new
`vplan-test-transform` option, which builds VPlan0 for each loop in the
input IR and then can invoke a set of transforms on it.

In order to allow different recipe types to be created, a new
widen-from-metadata transform is added, which transforms VPInstructions
to different recipes, based on custom !vplan.widen metadata. Currently
this supports creating widen & replicate recipes, but can easily be
extended in the future.

Currently the handling is intentionally bare-bones, to be extended
gradually as needed.

PR: https://github.com/llvm/llvm-project/pull/178522
2026-02-23 22:49:00 +00:00
Nicolai Hähnle
4a788031e8
AMDGPU: Cleanup the handling of flags in getTgtMemIntrinsic (#179469)
Some of the flag handling seems a bit inconsistent and dodgy, but this
is meant to be a pure refactoring for now.
2026-02-23 14:47:18 -08:00
Brian Cain
c3a86ff2d0
[Hexagon] Fix extractHvxSubvectorPred shuffle mask for small predicates (#181364)
The loop generating the shuffle mask in extractHvxSubvectorPred used
HwLen/ResLen as the iteration count, but each iteration produces 8
elements (ResLen * Rep where Rep = 8/ResLen). This means the total mask
size was (HwLen/ResLen) * 8, which only equals HwLen when ResLen == 8.
For smaller predicate subvectors (e.g., <4 x i1> or <2 x i1>), the mask
was too large, causing an assertion failure in getVectorShuffle.

Fix by using HwLen/8 as the loop bound, which correctly produces HwLen
elements regardless of ResLen.
2026-02-23 16:46:15 -06:00
David Green
476492bd16
[AArch64] Add basic scmp and ucmp costs. (#182180)
This adds basic llvm.scmp and llvm.ucmp costs. Scalars are costed as
cmp+cset+csinv. Neon vectors can use cmgt - cmgt as the vectors write
full vector lanes.
2026-02-23 22:39:24 +00:00
Nicolai Hähnle
6eb63c69e1
[CodeGen] Remove legacy getTgtMemIntrinsic overload (#175846)
It is now fully unused.
2026-02-23 22:33:12 +00:00
Jordan Rupprecht
df128ce63e
[clang][ssaf][NFC] Avoid incomplete EntitySummary type breakage (#182946)
When parsing LUSummary.h as a standalone header unit, EntitySummary is
an incomplete type, causing compilation to fail:

```
__memory/unique_ptr.h:72:19: error: invalid application of 'sizeof' to an incomplete type 'clang::ssaf::EntitySummary'
   72 |     static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
...
clang/include/clang/Analysis/Scalable/EntityLinker/LUSummary.h:48:12: note: in instantiation of member function 'std::map<clang::ssaf::SummaryName, std::map<clang::ssaf::EntityId, std::unique_ptr<clang::ssaf::EntitySummary>>>::map' requested here
   48 |   explicit LUSummary(NestedBuildNamespace LUNamespace)
      |            ^
clang/include/clang/Analysis/Scalable/EntityLinker/LUSummary.h:27:7: note: forward declaration of 'clang::ssaf::EntitySummary'
   27 | class EntitySummary;
```

This is not a total breakage because this header file builds
successfully when used in a .cpp file that includes EntitySummary.h
prior to this.

See https://llvm.org/docs/CodingStandards.html#self-contained-headers
2026-02-23 22:26:05 +00:00
CatherineMoore
1c7cb39849
[Clang][Docs] Update OpenMP support status for loop transformations (#182591)
Update loop fusion transformation codegen status to done and add
additional PR links. Mark loop index set splitting parsing as in
progress.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 17:03:01 -05:00
Craig Topper
c716009d71 [RISCV] Remove unnecessary setOperationAction for P extension. NFC
We default all vector operations to Expand for P so this one is
redundant.
2026-02-23 13:51:08 -08:00
Matt Arsenault
8604b52e38
RuntimeLibcalls: Fix adding __safestack_pointer_address by default (#182936)
This was accidentally added to the default set of libcalls, so move
it out of the giant let block over functions in the default set.

Should fix regression on SPARC bot.
2026-02-23 21:32:17 +00:00
Tal Keren
cb0b13d9d7
[lld][MachO] Enable LoopVectorization and SLPVectorization for ThinLTO (#182748)
Commit 21a4710c67a97838dd75cf60ed24da11280800f8 previously enabled
LoopVectorization and SLPVectorization CodeGen options for the ELF and
COFF LTO backends. Since the Mach-O LTO port did not exist at the time,
it missed this configuration.

This patch adds these options to the Mach-O LTO setup for consistency
with the other backends. Without this, SLP and loop vectorization passes
are silently skipped during Mach-O LTO for O2 and O3 builds.
2026-02-23 21:30:41 +00:00
Stanislav Mekhanoshin
9829d082af
[AMDGPU] Update gfx1250 sched model to latest table (#182923) 2026-02-23 13:25:07 -08:00
Florian Mayer
b4564abb01
[NFC] [FlowSensitive] [StatusOr] add test for coroutine crash
Reviewers: jvoung

Reviewed By: jvoung

Pull Request: https://github.com/llvm/llvm-project/pull/182604
2026-02-23 13:24:38 -08:00
Florian Mayer
df58e0f500
[FlowSensitive] [StatusOr] add test involving co_return
Reviewers: jvoung

Reviewed By: jvoung

Pull Request: https://github.com/llvm/llvm-project/pull/182610
2026-02-23 13:23:58 -08:00
Florian Mayer
423356326b
[NFC] [FlowSensitive] add mock task header for coroutines
Reviewers: jvoung, rohanjr

Pull Request: https://github.com/llvm/llvm-project/pull/182612
2026-02-23 13:22:46 -08:00
Jordan Rupprecht
0b66a3aa56
[bazel] Add missing llc test dep (#182937)
Used by mlir/test/Dialect/X86Vector/dot-bf16.mlir, which seems to not be
running due to some other misconfiguration.
2026-02-23 21:08:37 +00:00
Jinsong Ji
372c65d7a3
[NFC][IR] Fix MSVC C4706 diagnostic w/ 741b2cda32e1 (#182682)
Fix error:

llvm\include\llvm\IR\Operator.h(279) : error C2220: the following
warning is treated as an error
llvm\include\llvm\IR\Operator.h(279) : warning C4706: assignment within
conditional expression
2026-02-23 16:02:13 -05:00
Martin Storsjö
48a5119d8e
[openmp] Allow testing OpenMP without a full clang build tree (#182470)
Having a build tree with "not" and "FileCheck" is still required, but if
Clang/Flang isn't configured in that build, run the tests with the same
compiler CMake uses. This is how testing worked in the standalone build
configurations that now have been removed.
2026-02-23 23:01:44 +02:00