571326 Commits

Author SHA1 Message Date
Aiden Grossman
7fb92cdf5f
[Benchmark] Fix warnings around usage of __COUNTER__ (#184524)
Premerge CI is currently failing with the following after the update to
clang v22:

```
/home/gha/llvm-project/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:92:1: error: '__COUNTER__' is a C2y extension [-Werror,-Wc2y-extensions]
   92 | BENCHMARK(dexQueries);
      | ^
```

Some original work was done around this in
df1d786c460e0e47c9074f3533f098190ebfbc1b, which was then done in
upstream Google benchmark in

d8db2f90b6.
The original work done in the patch implementing this feature doesn't
seem to account for as many cases as the upstream patch does. This patch
reverts the diff in df1d786c460e0e47c9074f3533f098190ebfbc1b and applies
the applicable hunks from the upstream patch.
2026-03-04 01:39:16 +00:00
Craig Topper
98c46261d9
[TargetLowering][PowerPC] Don't unroll vector CLMUL when MUL is not supported. (#184238)
We can use the bittest lowering instead.
2026-03-03 17:25:54 -08:00
Keith Smiley
1c434928d2
[bazel] Remove old zlib config variable (#184527)
Use was removed in a268127736e4d703cef8c9f4841f9a8e8ac21ba7
2026-03-03 17:20:44 -08:00
Keith Smiley
3a85d99a16
[bazel] Fix building lldb with zlib disabled (#184525)
In cmake this value is set in llvm-config.h, we're not really handling
that the same way in bazel so we can just allow all targets to inherit
this disabled, otherwise it fails since lldb assumes it is always
something
2026-03-03 17:20:31 -08:00
Sam Clegg
928505c983
[lld][WebAssembly] Convert more tests to assembly. NFC (#184418)
The only expectations change here is that `__stack_pointer` is
no longer exports in the `archive-export.test` test. This is because
we don't enable the mutable-globals feature (since the assembly files
don't contains all the now-default features of the generic CPU).
2026-03-03 17:04:20 -08:00
Jianhui Li
3b4d5ffe84
[MLIR][XeGPU] Add blocking and subgroup to lane distribution support for ConvertLayout operation (#183837)
This PR refactors blocking support for ConvertLayout op to allow it
unrollable, not just removing it for specialize case.
It also removes the foldable attribute for ConvertLayout op, as we
expect the OP to be explicitly handled by XeGPU lowering.
It adds subgroup to lane distribution support for ConvertLayout op.
2026-03-03 17:03:51 -08:00
Jonas Devlieghere
45dbce3a3a
[lldb] Wrap LLDBLog Initialize/Terminate in a class (NFC) (#184469)
This matches what we do for all the other log channels (GDB Remote,
POSIX, Windows, KDP, etc).
2026-03-04 00:41:39 +00:00
Jonas Devlieghere
53fbbaa577
[lldb] Fix Initialization/Termination for all log channels (#184467)
Similar to #184261, but for all the other log channels.
2026-03-03 16:38:38 -08:00
Alexey Bader
699563e0da
[NFC] Don't replicate hasKernelCallingConv. (#184464)
isKernel function duplicates llvm::Function::hasKernelCallingConv
method.
2026-03-04 00:35:02 +00:00
John Harrison
5e5f7efd77
[lldb] Expose block equality with SBBlock. (#184222)
Adding the `operator==` and `operator!=` for SBBlock. This should allow
us to compare blocks within a frame, like:

```python
block = frame.GetBlock()
while True:
  if block == frame.GetFrameBlock():
    # we're at the top function scope.
  else:
    # we're at an inner block scope.
```
2026-03-03 16:19:58 -08:00
Peter Klausler
60d729fdb2
[flang] Fix test breakage from recent preprocessor change (#184455)
!$omp must never be recognized as a compiler directive sentinel when it
is immediately followed by anything other than a space or &. Revert a
bit of a recent change that broke this.
2026-03-03 16:00:20 -08:00
Ian Wood
630b9570d1
[mlir][math] Add constant folding for math.rsqrt (#184443)
Add a fold() method to RsqrtOp, matching the pattern used by SqrtOp and
other math unary ops. The fold computes `1.0 / sqrt(x)` using APFloat
division.

---------

Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
2026-03-03 15:50:10 -08:00
Dave Lee
ece4b75932
[lldb] Add C source output mode to formatter_bytecode.py (#184242)
Add the ability to generate a C source file, which is in addition to the
existing functionality of generating binary.

An example of the generated source:

```c
#ifdef __APPLE__
#define FORMATTER_SECTION "__DATA_CONST,__lldbformatters"
#else
#define FORMATTER_SECTION ".lldbformatters"
#endif

__attribute__((used, section(FORMATTER_SECTION)))
unsigned char _Account_synthetic[] =
    // version
    "\x01"
    // remaining record size
    "\x15"
    // type name size
    "\x07"
    // type name
    "Account"
    // flags
    "\x00"
    // sig_get_num_children
    "\x02"
    // program size
    "\x02"
    // program
    "\x20\x01"
    // sig_get_child_at_index
    "\x04"
    // program size
    "\x06"
    // program
    "\x02\x20\x00\x23\x11\x60"
;
```
2026-03-03 15:48:30 -08:00
Justin Fargnoli
76568dc899
[LoopUnrollPass] Add const to parameters in computeUnrollCount (NFC) (#184058) 2026-03-03 23:39:32 +00:00
Florian Mayer
0c04d019f0
[NFC] [Doc] Fix text codeblock being declared llvm (#184461) 2026-03-03 23:35:14 +00:00
Susan Tan (ス-ザン タン)
62144f48d4
[flang] make lowering to scf.while default (#184234)
We've tested the implementation of fortran do-while loops being lowered
to scf.while and want to make it the default option.
2026-03-03 18:26:36 -05:00
Arthur Eubanks
393bbd5520
[gn build] Port commits (#184454)
282a2b77c358
60eac414b794
6d82f143dee1
80a1cf4f8058
8a9049198d18
a171b8d4d523
f3e8508ac771

Move X86GenAsmMatcher into llvm/lib/Target/X86
2026-03-03 23:20:50 +00:00
Florian Mayer
0c9734f120
[NFC] [doc] fix invalid comment syntax in IR (#184457) 2026-03-03 23:20:31 +00:00
Derek Schuff
87a4b36fbe
[WebAssembly] Use MVT::i32 instead of i1 in performAnyAllCombine (#183866)
The CombineSetCC helpers and performAnyAllCombine generate MVT::i1
results.
However MVT::i1 is an illegal type in WebAssembly, and this combiner can
run either before or after legalization. Directly creating the intrinsic
and negating its result using XOR instead of i1 and a NOT operation
avoids this problem.

Fixes #183842
2026-03-03 15:19:23 -08:00
zhouguangyuan0718
e71f327b46
[X86] support reserve r8~r15 on X86_64 (#180242)
Which is under discussion in
https://github.com/llvm/llvm-project/issues/179036

Add new options -ffixed_r{8-15} for clang X86 target, like option
"-ffixed_x" for RISCV/AArch64 target.
Also, add target-feature +reserve-r{8-15} for the X86 backend.

The registers which are specified reserved will not be used in
RegAlloc/CalleeSave. Then the reserved registers can be maintained by
user. It will be useful for the runtime/interpreter implementation.

Other registers are used in specific instructions or mechanism, so they
can't be reserved.
2026-03-03 22:42:49 +00:00
Joseph Huber
1b633d6d6d
[Clang] Permit floating point and pointer values in most atomic ops (#183843)
Summary:
We already support floating point arguments for the standard atomic
functions. LLVM supports these in most cases as well. This PR unifies
the handling and allows this in the cases that the LLVM IR supports.
2026-03-03 16:35:04 -06:00
Jonas Devlieghere
28638f5197
[lldb] Remove Debugger::{FindTargetWithProcessID, FindTargetWithProcess} (#184446)
In #184259, Jim noticed that Debugger::FindTargetWithProcess and
Debugger::FindTargetWithProcessID are rather poorly designed APIs as
tehy allow code running in one Debugger to mess with Targets from
another Debugger. The only use is Process::SetProcessExitStatus which
isn't actually used.
2026-03-03 14:29:15 -08:00
Jason Molenda
f4e64ceb4b
[lldb] AArch64 register 33 is not cpsr (#183860)
I have an unwind failure where the eh_frame for a
trap handler states that the caller's return address is in eh_frame
register 33, which lldb treats as cpsr.
https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#dwarf-register-names
Register 33 is ELR_mode, which isn't defined as a register in any of the
AArch64 register definition files in lldb today, so I'm not adding it to
the header files.

rdar://170602999
2026-03-03 14:28:00 -08:00
mitchell
685a65a7f0
[clang-tidy] Add zeyi2 as maintainer (#183883)
I've been actively contributing to `clang-tidy` for the past 4 months,
reviewing PRs, [fixing
issues](https://github.com/pulls?q=is%3Apr+author%3Azeyi2+archived%3Afalse+user%3Allvm+is%3Aclosed+label%3Aclang-tidy+sort%3Aupdated-desc),
engaging in discourse discussions and building [new testing
tools](https://github.com/clang-tidy-infra/CTIT). I'm passionate about
and project and would like to volunteer as a maintainer to continue
supporting the project's growth :)
2026-03-04 06:24:16 +08:00
Jonas Devlieghere
9264159ae1
[lldb] Fix the GoogleTest teardown in the DAP unit tests (#184262)
Some of the DAP tests define a static method named `TeatUpTestSuite`
which is calling `SBDebugger::Terminate`. Besides the typo, the correct
method is `TearDownTestSuite`, which GoogleTest calls after running the
last test in the test suite.

When addressing this, I realized that currently you can't really call
Initialize and Terminate multiple times in the same process. This
depends on:

- https://github.com/llvm/llvm-project/pull/184259
- https://github.com/llvm/llvm-project/pull/184261
2026-03-03 14:15:39 -08:00
Changpeng Fang
5b144c0aec
[AMDGPU] Add suffix _d4 to tensor load/store with 4 groups D#, NFC (#184176)
Rename TENSOR_LOAD_TO_LDS to TENSOR_LOAD_TO_LDS_d4;
  Rename TENSOR_STORE_FROM_LDS to TENSOR_STORE_FROM_LDS_d4;
Also rename function names in a couple of tests to reflect this change.
2026-03-03 14:10:38 -08:00
Ayokunle Amodu
1953b87a31
[CIR][CodeGen] Upstream support for __builtin_isinf_sign (#183977)
This adds CIR codegen and lowering support for `__builtin_isinf_sign`.
2026-03-03 14:01:49 -08:00
Henrich Lauko
89a4bcf023
[CIR] Split cir.binop into separate per-operation binary ops (#184227)
Replace the single `cir.binop` operation (dispatched via a `BinOpKind`
enum) with nine distinct ops — `cir.add`, `cir.sub`, `cir.mul`,
`cir.div`, `cir.rem`, `cir.and`, `cir.or`, `cir.xor`, and `cir.max` —
each with precise type constraints and only the attributes it needs
(nsw/nuw/sat on add/sub via `BinaryOverflowOp`).

A new `BinaryOpInterface` provides uniform `getLhs`/`getRhs`/`getResult`
access for passes and analyses.

The monolithic switch-based CIRToLLVMBinOpLowering is replaced by per-op
patterns generated through the existing CIRLowering.inc TableGen
infrastructure, with shared dispatch factored into two helpers:
`lowerSaturatableArithOp` for add/sub and `lowerIntFPBinaryOp` for
div/rem.
2026-03-03 22:34:18 +01:00
Jonas Devlieghere
c4ea6cc3f7
[lldb] Remove call_once wrappers around PluginManager::RegisterPlugin (#184273)
Remove call_once wrappers around PluginManager::RegisterPlugin. Plugins
can be registered and unregistered in Initialize and Terminate
respectively. In its current state, after having called Terminate, a
plugin can never be re-initialized.
2026-03-03 13:17:21 -08:00
Jonas Devlieghere
6b5c55ef16
[lldb] Fix 10 year old leak of g_debugger_list_ptr (#184259)
Roughly 10 years ago, in aacb80853a46bd544fa76a945667302be1de706c, Greg
deleted the call to delete g_debugger_list_ptr because of a race
condition:

> Fixed a threading race condition where we could crash after calling
Debugger::Terminate().
> 
> The issue was we have two global variables: one that contains a
DebuggerList pointer and one that contains a std::mutex > pointer. These
get initialized in Debugger::Initialize(), and everywhere that uses
these does:
> 
> if (g_debugger_list_ptr && g_debugger_list_mutex_ptr)
> {
> std::lock_guard<std::recursive_mutex>
guard(*g_debugger_list_mutex_ptr);
>     // do work while mutex is locked
> }
> 
> Debugger::Terminate() was deleting and nulling out g_debugger_list_ptr
which meant we had a race condition where someone might do the if
statement and it evaluates to true, then another thread calls
Debugger::Terminate() and deletes and nulls out g_debugger_list_ptr
while holding the mutex, and another thread then locks the mutex and
tries to use g_debugger_list_ptr. The fix is to just not delete and null
out the g_debugger_list_ptr variable.

However, this isn't necessary as long as we persist ("leak") the mutex
and always check it first. That's exactly what this patch does. Without
it, the assert in Debugger::Initialize is incorrect.

```
assert(g_debugger_list_ptr == nullptr &&
       "Debugger::Initialize called more than once!");
```
2026-03-03 13:15:49 -08:00
vporpo
fe76fd292c
[AMDGPU][SIInsertWaitcnts][NFC] Call applyWaitcnt() in a loop (#184426) 2026-03-03 13:13:21 -08:00
Yoonseo Choi
fdc4a982f5
[AMDGPU] Add dereferenceable retAttr to a call to llvm.amdgcn.implicitarg.ptr (#182206) 2026-03-03 21:58:12 +01:00
Simon Pilgrim
dc1e3e5dbf
[X86] getFauxShuffleMask - add ISD::ROTL/ROTR handling (#184417)
Very similar to the existing X86ISD::VROTLI/VROTRI handling

Prep work for #184002
2026-03-03 20:52:38 +00:00
Joseph Huber
dc44bcafe0
[flang-rt] Fix NVPTX builds erroneously using backtrace support (#184415)
Summary:
This is caused  by the CMake hacks I had to do to worm around NVIDIA's
proprietary binaries.
2026-03-03 14:38:53 -06:00
Sean Fertile
df1a53ae24
Disable leak sanitizer test on ppc. (#184414)
Test is flaky and fails due to machine load on the build bots. Disable
until we can split the build bots over more machines.
2026-03-03 15:27:20 -05:00
Aiden Grossman
4b06e83885
[Github][CI] Bump CI containers to LLVM v22.1.0 (#184375) 2026-03-03 12:26:02 -08:00
Matt Arsenault
80a1cf4f80
clang: Add builtin header for amdhsa abi (#181993) 2026-03-03 21:24:17 +01:00
Simon Pilgrim
9d0c62c3dd
[X86] known-never-zero.ll - improve demandedelts test coverage for #183227 (#184411)
The original tests from #184350 were recognising every element as
non-zero
2026-03-03 20:20:44 +00:00
Andy Kaylor
375d65ee8d
[CIR] Implement EH lowering to Itanium form and LLVM IR (#184386)
This introduces a new pass to lower from a flattened, target-independent
form of CIR to a form that uses Itanium-specific representation for
exception handling. It also includes a small amount of code needed to
lower the Itanium form to LLVM IR.

Substantial amounts of this PR were created using agentic AI tools, but
I have carefully reviewed the code, comments, and tests and made changes
as needed.
2026-03-03 20:09:49 +00:00
Florian Mayer
5586d93a87
[NFC] [HWASan] more meaningful BB names in use-after-scope test (#183867) 2026-03-03 12:05:18 -08:00
lihengda861-source
b4dfa43cb8
[RISCV] Fix type inference ambiguity in SwapSysReg pattern (#184305)
Issue:
Building RISCVInstrInfo.td fails with the following TableGen error
during the generation of RISCVGenInstrInfo.inc:
     ` error: In test: Could not infer all types in pattern!`

Root Cause:
The riscv_swap_csr node has a polymorphic result type (i32 or i64
depending on the target architecture). When used inside the SwapSysReg
class pattern, TableGen's type inference engine cannot automatically
deduce the exact return type solely from the GPR:$rd output, leading to
the ambiguity error.

Fix:
This patch resolves the type ambiguity by explicitly wrapping the
riscv_swap_csr node with XLenVT, allowing TableGen to infer the types
correctly.
2026-03-03 11:57:38 -08:00
Kaitlin Peng
8272546f69
[HLSL][SPIRV] Fix faceforward pattern matcher logic (#183630)
Fixes a logic issue in the `faceforward` pattern matcher in
`SPIRVCombinerHelper.cpp`.
Previously when `mi_match` failed, we would still go through the nested
`Pred == CmpInst::FCMP_OGT || Pred == CmpInst::FCMP_UGT` check. It was
possible that whatever garbage was in Pred could randomly pass this
check and make us continue through the code. This change fixes that
logic issue by returning false as soon as `mi_match` fails.

Likely fixes #177803. Can't confirm since it seems another change has
obscured the crash.
2026-03-03 11:47:41 -08:00
Florian Hahn
17aaa0e590
[VPlan] Use bitfield to store Cmp predicates and GEP wrap flags. (NFC) (#181571)
Instead of storing CmpInst::Predicate/GepNoWrapFlags, only store their
raw bitfield values. This reduces the size of VPIRFlags from 12 to 3
bytes.

PR: https://github.com/llvm/llvm-project/pull/181571
2026-03-03 19:46:30 +00:00
Finn Plummer
899080a87a
[Analysis][DXILResource] Correct bound computation (#184198)
The range is an unsigned integer where a value of `UINT32_MAX` denotes
an unbounded range

The current implementation implied that any size interpreted as a signed
integer that is negative was unbounded, which is incorrect.

Adds a note to the docs
2026-03-03 19:34:50 +00:00
Erich Keane
b5baf5e062
[CIR] Implement func-ptr/void-ptr addition/subtraction/inc/dec. (#184254)
As a GNU extension, clang supports math on void* and function pointers
in C mode only. From a CIR perspective, it makes sense to leave these
types in the IR, since it might be useful to do analysis.

During lowering, we already properly lower these to a size-1 element, so
there is no changes that need to happen besides letting this get through
CIR generation. This patch does that, plus adds some tests.
2026-03-03 11:29:27 -08:00
Andy Kaylor
c7c16573b8
[CIR] Synchronize CIR with recent changes to atomic ops (#184416)
This synchronizes the CIR atomic expression handling with changes that
were made in https://github.com/llvm/llvm-project/pull/183853
2026-03-03 19:27:54 +00:00
Louis Dionne
a5ca0ec16b
[libc++] Update documentation for _executeWithFakeConfig (#184420) 2026-03-03 19:25:11 +00:00
Jason Van Beusekom
2d4c8e0d0f
[OpenMP][clang] Indirect and Virtual function call mapping from host to device (#184412)
This patch implements the CodeGen logic for calling __llvm_omp_indirect_call_lookup
on the device when an indirect function call or a virtual function call is made
within an OpenMP target region.
---------
Co-authored-by: Youngsuk Kim
2026-03-03 13:20:24 -06:00
Erich Keane
03bd4ef4ec
[CIR] Handle vtable pure and deleted virtual functions (#183862)
Finding reproducers for these that don't use the deferred vtable (which
    we haven't yet implemented) was a bit of a challenge, but I found
this setup to get these to be emitted. Fortunately it is a quite easy
implementation that doesn't do awfully much.

This patch implements both, plus the name through the itanium ABI.
2026-03-03 11:11:01 -08:00
Razvan Lupusoru
6893d27757
[flang][acc] Improve clause validity check around do concurrent (#184389)
The current validity message prints out both "TILE" and "COLLAPSE" even
if just one of them is used. This makes it confusing if the user only
used one of them. This improves the messages to be precise which clause
is not allowed (and separate messages are issued when both clauses are
used).
2026-03-03 11:03:01 -08:00