563246 Commits

Author SHA1 Message Date
Ricardo Jesus
e8391d4619
[AArch64] Set default schedule of load-acquire RCpc instructions. (#172881)
This patch sets the default schedule of RCpc load-acquires to WriteLD,
same as it's done for rcpc-immo load-acquires.
2025-12-19 09:25:34 +00:00
Cullen Rhodes
64d4d10875
[InstCombine] Add more freeze PHI tests (NFC) (#172842)
Adds a number of test cases where we have to be careful when pushing
freeze around. These first two tests are taken from #157678 which failed
to land to due compile-time issues. The last two tests were reduced from
llvm-opt-benchmark workloads on #171435 which was an attempt at
addressing underlying cause of the hangs.
2025-12-19 09:16:57 +00:00
Matt Arsenault
0db4393762
AMDGPU: Add baseline tests for f64 rsq pattern handling (#172052) 2025-12-19 10:12:25 +01:00
Nikita Popov
8c93254dfc [LSR] Add test for implicit truncation on icmp immediate (NFC)
Test case for:
https://github.com/llvm/llvm-project/pull/171456#issuecomment-3670755137
2025-12-19 10:07:50 +01:00
Nikita Popov
0182c859f1
[OCaml] Remove deprecated const_nuw_neg and build_nuw_neg APIs (#171466)
I think we usually remove deprecated C API functions from the OCaml
bindings right away. These two at least should be essentially useless.
2025-12-19 09:49:33 +01:00
Nikita Popov
a22d1b5d43
[ConstantInt] Add ImplicitTrunc parameter to getSigned() (NFC) (#172875)
For consistency with `ConstantInt::get()`, add an ImplicitTrunc
parameter to `ConstantInt::getSigned()` as well. It currently defaults
to true and will be flipped to false in the future (by #171456).
2025-12-19 09:48:26 +01:00
Chuanqi Xu
8994d399fa [NFC] [C++20] [Modules] Add a test for issue 149404
Close https://github.com/llvm/llvm-project/issues/149404 and add its
reproducer
2025-12-19 16:47:19 +08:00
hellozmz
ecf979cdb6
[mlir] [docs] fix toy readme (#172262)
mlir toy docs use the deprecated api, so I fix it.
2025-12-19 09:41:44 +01:00
Chuanqi Xu
c6cccbfe08 [NFC] [C++20] [Modules] Add test for issue 137533
Close https://github.com/llvm/llvm-project/issues/137533

This may be fixed by other PR before. Adding a test for avoid further regression.
2025-12-19 16:08:05 +08:00
Chuanqi Xu
04638a76c1 [NFC] [C++20] [Modules] Adding test for typeinfo
Complained by https://github.com/llvm/llvm-project/issues/162758
but failed to reproduce.

Adding the reproducer as a test since I feel testing are always good.
2025-12-19 15:52:27 +08:00
Chuanqi Xu
5937d7f907 [C++20] [Modules] Correct the behavior for adding mangling for lambda in modules
Close https://github.com/llvm/llvm-project/issues/130080
Close https://github.com/llvm/llvm-project/issues/116087

The common pattern of the problem is the lambda is somehow leaked from a
non-inline non-internal function in module purview, and we need to
define a mangling for it by the discuss from
https://github.com/itanium-cxx-abi/cxx-abi/issues/186

The root cause of the issue is a mismatch that give up too quickly when
ManglingContextDecl is nullptr. But we can still get the context
information from DC.
2025-12-19 15:44:34 +08:00
Abhishek Varma
b290a3e12b
[Linalg] Add *Pooling* matchers (#172351)
-- This commit is the eighth in the series of adding matchers
for linalg.*conv*/*pool*. Refer:
https://github.com/llvm/llvm-project/pull/163724
-- In this commit all variants of Pooling ops have been added.

Signed-off-by: Abhishek Varma <abhvarma@amd.com>
2025-12-19 13:01:02 +05:30
Lang Hames
94cb105055
[ORC] Initialize the native target in ReOptimize unit test. (#172955)
The ReOptimize unit test was accidentally depending on native target
initialization in previous tests, causing it to be skipped if run on its
own (using --gtest_filter).

Calling OrcNativeTarget::initialize() in the SetUp method of the test
fixes this.
2025-12-19 18:30:37 +11:00
Henrich Lauko
32243a54f8
[MLIR] Add DefaultValuedEnumAttr decorator (#172916)
Introduce DefaultValuedEnumAttr, which similarly to DefaultValuedAttr
decorates an enum attribute to have a default value from a specific enum
case when not present. The default is constructed as the fully-qualified
enum case symbol.

In comparison to DefaultValuedAttr, this allows using a TableGen
EnumCase
variable instead of a raw string.
2025-12-19 08:29:53 +01:00
Mohamed Atef
2c98c6ee0e
[libcxx] LWG4172 fix self-move-assignment in {unique|shared}_lock (#129542)
Fixes: https://github.com/llvm/llvm-project/issues/127861

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-12-19 15:06:39 +08:00
Wenju He
d5326411fe
[libclc] Improve __clc_min/max/clamp implementation (#172599)
Replace __clc_max/min with __clc_fmax/fmin in __clc_clamp. FP
__clc_min/max/clamp now lowers to @llvm.minimumnum/@llvm.maximumnum, and
integer clamp lowers to @llvm.umin/@llvm.umax. This reduce fcmp+select
chains and improving codegen. Example change to amdgcn--amdhsa.bc:
```
in function _Z5clamphhh:
    >   %4 = icmp ugt i8 %0, %2
        %4 = tail call noundef i8 @llvm.umax.i8(i8 %0, i8 %1)
    >   %6 = select i1 %4, i8 %2, i8 %5
    >   ret i8 %6
    <   %5 = tail call noundef i8 @llvm.umin.i8(i8 %2, i8 %4)
    <   ret i8 %5
in function _Z5clampddd:
  in block %3 / %3:
    >   %4 = fcmp ogt double %0, %2
    >   %5 = fcmp olt double %0, %1
    >   %6 = select i1 %5, double %1, double %0
    >   %7 = select i1 %4, double %2, double %6
    >   ret double %7
    <   %4 = tail call noundef double @llvm.maximumnum.f64(double %0, double %1)
    <   %5 = tail call noundef double @llvm.minimumnum.f64(double %4, double %2)
    <   ret double %5
```
2025-12-19 14:36:03 +08:00
Teresa Johnson
37a73d587a
[MemProf] Update metadata verification for a single string tag (#172543)
The memprof metadata verifier supported multiple string tags, but in
reality, the other code (e.g. addCallStack) only supports a single such
tag. Update the verifier to reflect that limitation, and the associated
tests.

Fixes #157217
2025-12-18 22:19:04 -08:00
Nishant Sachdeva
6c51c17eec
[NFC][llvm-ir2vec] llvm_ir2vec.cpp breakup to extract a reusable header for IR2VecTool, and MIR2VecTool classes (#172304)
Refactor llvm-ir2vec: Extract reusable header for Python bindings

Separated the IR2Vec/MIR2Vec tool implementation into a header file
(`llvm-ir2vec.h`) and implementation file (`llvm-ir2vec.cpp`) to enable
reuse in Python bindings and other projects.

Changes
- **Created `llvm-ir2vec.h`**: Contains `IR2VecTool` and `MIR2VecTool`
class definitions with all implementations, making it a standalone
header-only library
- **Simplified `llvm-ir2vec.cpp`**: Now contains only command-line
interface code (options, main function, and helper functions)

Motivation
The original monolithic `.cpp` file made it impossible to use
IR2Vec/MIR2Vec functionality in Python bindings without compiling the
entire command-line tool. This refactoring enables clean separation
between the library interface and the CLI tool. This will enable easier
development for the upcoming python bindings
[HERE](https://github.com/llvm/llvm-project/issues/141839)

Testing
All existing tests pass without modification. No functional changes.
2025-12-19 11:28:22 +05:30
Teja Alaghari
b4b5bfaf40
[CodeGen][NPM] Update MPDT similar to MDT after unreachable BB elimination (#172421)
After unreachable machine basic blocks are removed, MPDT should also be
updated with the latest block numbers alongside MDT.
2025-12-19 11:09:49 +05:30
Teja Alaghari
4e89e710d9
[CodeGenPrepare][NPM] Remove incorrect LoopAnalysis preservation in CodeGenPrepare (#172418)
CodeGenPrepare modifies and restructures loops & control flow. So, it
shouldn't preserve LoopAnalysis.

The test `llvm/test/CodeGen/AMDGPU/cf-loop-on-constant.ll` shows
CodeGenPrepare modifying loop structure, hence we cannot preserve
LoopAnalysis.
2025-12-19 11:08:31 +05:30
Justin Bogner
b324c9f4fa
[DirectX] Move memset and memcpy handling to a new pass. NFC (#172921)
This introduces the DXILMemIntrinsics pass and moves memset and memcpy
handling from DXILLegalize to here. We need to do this so that we can
handle memory intrinsics before the DXILResourceAccess pass so that we
can properly deal with arrays and large structures in resources.
2025-12-18 22:08:43 -07:00
thetruestblue
f171b431d2
[Test][NFC] Update test to match new warning output (#172950)
https://github.com/llvm/llvm-project/pull/170815

rdar://166742792
2025-12-18 21:41:02 -07:00
Brandon Wu
0e03199e81
[RISCV][llvm] Remove custom legalization of fixed-length vector SPLAT_VECTOR (#172870)
BUILD_VECTOR is combined to SPLAT_VECTOR if operation action of
SPLAT_VECTOR is not Expand. However we already have custom handle of
BUILD_VECTOR for fixed-length vector which has explicit constant VL
instead of making it VLMAX if lowered through SPLAT_VECTOR.
2025-12-19 11:45:10 +08:00
Eric Feng
24c7b4ea48
[mlir][amdgpu] implement amdgpu.sparse_mfma wrapper for smfmac instructions (#171968)
Signed-off-by: Eric Feng <Eric.Feng@amd.com>
2025-12-18 20:16:14 -06:00
Alex MacLean
a40f444265
[NVPTX] Add support for barrier.cta.red.* instructions (#172541)
This change adds full support for the ptx `barrier.cta.red` instruction,
following the same conventions as are already used for
`barrier.cta.sync` and `barrier.cta.arrive`.

In addition this MR removes the following intrinsics which are no longer
needed:
* llvm.nvvm.barrier0.popc -->
  llvm.nvvm.barrier.cta.red.popc.aligned.all(0, c)
* llvm.nvvm.barrier0.and -->
  llvm.nvvm.barrier.cta.red.and.aligned.all(0, z)
* llvm.nvvm.barrier0.or -->
  llvm.nvvm.barrier.cta.red.or.aligned.all(0, z)
2025-12-18 18:06:27 -08:00
Starlight
7ee923d0ec
[CIR] Upstream convert to mask builtins in CIR codegen (#171694)
This PR is part of https://github.com/llvm/llvm-project/issues/167752.
It upstreams the codegen and tests for the convert to mask builtins
implemented in the incubator, including:

Upstream X86 mask conversion builtins from clangir:
- cvtmask2b/w/d/q*
- cvtb/w/d/q2mask* 

Upstreamed helpers:
- emitX86MaskedCompare()
- emitX86ConvertToMask()
- emitX86SExtMask()
2025-12-19 01:54:31 +00:00
Giacomo Castiglioni
6e7a44986d
[MLIR] Enable dylib init/deinit in execution engine on AArch64 platform (#172833)
This PR enables JIT initialize for AArch64. Up to now it was disabled
because of #71963 which was recently fixed by #71968.
2025-12-19 01:55:21 +01:00
Cyndy Ishida
133253d31a
[clang] Generalize remaining diagnostics that assume all precompiled files are pchs, NFC (#172718) 2025-12-18 16:44:16 -08:00
Andy Kaylor
bae033b906
[CIR] Add support for null data member pointers (#171945)
This adds the CIR support for handling null data member pointer values.
2025-12-18 16:24:04 -08:00
Wenju He
776f5933c9
[libclc][NFC] Move convert builtins from Python generator to .cl sources (#172634)
Remove the Python dependency for generating convert builtins, aligning
with how other builtins are defined.
In addition, our downstream target relies on this PR to override convert
implementations.
llvm-diff shows no changes to all bitcodes:
amdgcn--amdhsa.bc, barts-r600--.bc, cayman-r600--.bc, cedar-r600--.bc,
clspv64--.bc, clspv--.bc, cypress-r600--.bc, nvptx64--.bc,
nvptx64--nvidiacl.bc, nvptx--.bc, nvptx--nvidiacl.bc, tahiti-amdgcn--.bc
and tahiti-amdgcn-mesa-mesa3d.bc.
2025-12-19 08:19:58 +08:00
Matt Arsenault
bb993a89a8
RuntimeLibcalls: Add entries for stack probe functions (#167453) 2025-12-19 01:17:20 +01:00
Louis Dionne
a04627621e
[libc++] Add missing %{flags} substitution to clang-tidy (#171689)
Flags that should be used both for compiling and for linking are
provided through the %{flags} substitution. Our clang-tidy tests should
be using them, not only %{compile_flags}.
2025-12-18 19:15:04 -05:00
Ivan Butygin
58c3b223ee
[mlir][rocdl] Add s_nop intrinsic (#172918)
Also, cleaned some whitespace in affected files.
2025-12-19 03:00:12 +03:00
adams381
c2f33b5a28
[CIR] Implement AggExprEmitter::VisitVAArgExpr (#172551)
This PR implements support for aggregate va_arg expressions in CIR
codegen.

## Changes

- **CIRGenBuiltin.cpp**: Modified `emitVAArg` to return a pointer type
for aggregate types. For aggregate types, `va_arg` returns a pointer to
the aggregate rather than the aggregate value itself.

- **CIRGenExprAggregate.cpp**: Implemented
`AggExprEmitter::VisitVAArgExpr` to handle aggregate va_arg expressions
by:
  - Getting the va_arg pointer from `emitVAArg()`
  - Creating an `Address` from the pointer with proper alignment
  - Creating an `LValue` from the `Address`
- Copying the aggregate value to the destination using
`emitFinalDestCopy()`

- **Test**: Added comprehensive test `var-arg-aggregate.c` with CIR,
LLVM, and OGCG checks to verify the implementation matches original
codegen behavior.

## Testing

All tests pass:
- `check-clang-cir-codegen`: 180/181 passed (99.45%)
- `check-clang-cir`: 423/424 passed (99.76%)
2025-12-18 15:53:04 -08:00
Ken Matsui
f5759eeb63
[clang][cmake] Add option to control scan-build-py installation (#172727) 2025-12-18 18:35:44 -05:00
Dan Bonachea
5836d45984
docs/ParallelMultiImageFortranRuntime: Update link to latest PRIF Specification (#172747)
The PRIF Committee is pleased to announce the publication of the
Parallel Runtime Interface for Fortran (PRIF) Specification, Revision
0.7. The latest iteration of this specification represents the efforts
of a collaborative design process involving multiple individuals across
several institutions.

The document is available here: <https://doi.org/10.25344/S46S3W>

The PRIF specification is governed by a formal PRIF Committee.
For more details, see: <https://go.lbl.gov/prif-governance>

The Committee vote to approve the technical content in this revision
began on 2025-11-24 and concluded on 2025-12-08 with unanimous approval.

The 7-day Committee comment period for cosmetic feedback began on
2025-12-08 and concluded on 2025-12-15 with no comments.

See the Change Log in Section 1 of the document for the list of changes
relative to the prior revision.
2025-12-18 15:34:36 -08:00
A. Jiang
43cd4a8539
[libc++][docs] Update paper and LWG issue lists after 2025-11 Kona (#172825)
Drive-by: Fix the entry for not-yet-adopted LWG3882.

Resolves #166267
2025-12-18 18:30:58 -05:00
Haocong Lu
6d6c0cc3bb
[CIR][X86] Implement lowering for _AddressOfReturnAddress builtin (#171974)
- Add new `CIR_AddrOfReturnAddrOp` and support lowering it to LLVMIR
- Add CIR CodeGen for `_AddressOfReturnAddress` X86 builtin
- Fix error return type of `FrameAddrOp`, and add missing test for
`_ReturnAddress`

Part of https://github.com/llvm/llvm-project/issues/167765
2025-12-18 14:48:19 -08:00
adams381
d524ecbf0f
[CIR] Add emitDeclInvariant for global with constant storage (#171915)
Implement emitDeclInvariant to emit llvm.invariant.start intrinsic for
global variables with constant storage. This enables optimizations by
marking when a global becomes read-only after initialization.

## Changes
- Add emitDeclInvariant and emitInvariantStart functions in
CIRGenCXX.cpp
- Add emitInvariantStart declaration in CIRGenFunction.h
- Update emitCXXGlobalVarDeclInit to call emitDeclInvariant for constant
storage globals after initialization
- Update getOrCreateCIRGlobal to set constant flag on globals with
constant storage
- Add comprehensive test covering positive and negative cases

## Implementation Details
The implementation handles address spaces correctly, dynamically
constructing the intrinsic name (e.g., invariant.start.p0,
invariant.start.p10) based on the pointer's address space. The intrinsic
is only emitted when optimizations are enabled, matching classic codegen
behavior.

## Testing
All tests pass (411/412, 1 unsupported). The test file includes CIR,
LLVM, and OGCG checks for both optimized and non-optimized builds.
2025-12-18 14:40:41 -08:00
Andy Kaylor
58cf128e50
[CIR] Move CIR CXXABI lowering to a standlone pass (#172133)
This moves the code that handles CXXABI-specific lowering in
ConvertCIRToLLVMPass into a standlone CIR-to-CIR transform pass. The
handling of these operations was already performing a CIR-to-CIR
transformation, with the CIR operations being further lowered to the
LLVM dialect. This change makes that transformation a separate pass.

The LowerModule object in ConvertCIRToLLVMPass will be unused after this
change, but removal of that object is being deferred to a follow-up PR
to keep this change isolated to a single purpose.

---------

Co-authored-by: Sirui Mu <msrlancern@gmail.com>

---------

Co-authored-by: Sirui Mu <msrlancern@gmail.com>
2025-12-18 22:36:17 +00:00
Andy Kaylor
73938a5768
[CIR] Make x86 i1 mask vectors signed (#172912)
A number of x86 builtins need to cast a mask value to a vector of i1
values. Strictly speaking, these i1 values should be signless. However,
we don't have signless types in CIR, so we have to choose whether to
represent them as signed or unsigned. It seemed natural to make them
unsigned. However, there are going to be multiple places where we want
to convert the vector of i1 to a vector of either all ones or all zeros,
and in those cases we'll need to sign-extend the vector values.

Rather than creating the vector as unsigned and casting it to signed in
the cases where we need to saturate the lane, I think it makes more
sense to just create it as signed. This change does that.
2025-12-18 14:33:48 -08:00
Med Ismail Bennani
7a3eddc19f [lldb/test] Fix failure caused by leading zero in TestScriptedFrameProvider.py
This should fix a test failure in TestScriptedFrameProvider.py:

https://lab.llvm.org/buildbot/#/builders/18/builds/23398/steps/6/logs/stdio

This is a happening because on 32bit system, addresses don't have the
leading zeroes. This patch removes them to satisfy the checks.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-18 23:28:29 +01:00
KRM7
c9aea6248a
[RegisterCoalescer] Don't commute two-address instructions which only define a subregister (#169031)
Currently, the register coalescer may try to commute an instruction
like:
```
%0.sub_lo32:gpr64 = AND %0.sub_lo32:gpr64(tied-def 0), %1.sub_lo32:gpr64
USE %0:gpr64
```
resulting in:
```
%1.sub_lo32:gpr64 = AND %1.sub_lo32:gpr64(tied-def 0), %0.sub_lo32:gpr64
USE %1:gpr64
```
However, this is not correct if the instruction doesn't define the
entire register, as the value of the upper 32-bits
of the register used in `USE` will not be the same.
2025-12-18 23:24:44 +01:00
Med Ismail Bennani
d6a73d08d5
[lldb] Add priority support to synthetic frame providers (#172848)
This patch adds `get_priority()` support to synthetic frame providers to
enable priority-based selection when multiple providers match a thread.
This is the first step toward supporting frame provider chaining for
visualizing coroutines, Swift async tasks, and et al.

Priority ordering follows Unix nice convention where lower numbers
indicate higher priority (0 = highest). Providers without explicit
priority return `std::nullopt`, which maps to UINT32_MAX (lowest
priority), ensuring backward compatibility with existing providers.

The implementation adds `GetPriority()` as a virtual method to
`SyntheticFrameProvider` base class, implements it through the scripting
interface hierarchy (`ScriptedFrameProviderInterface` and
`ScriptedFrameProviderPythonInterface`), and updates
`Thread::GetStackFrameList()` to sort applicable providers by priority
before attempting to load them.

Python frame providers can now specify priority:

```python
@staticmethod
def get_priority():
   return 10  # Or return None for default priority.
```

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-18 23:20:38 +01:00
Harald van Dijk
a9b62e8324
[AArch64] Make IFUNC opt-in rather than opt-out. (#171648)
IFUNCs require loader support, so for arbitrary environments, the safe
assumption is to assume that they are not supported. In particular,
aarch64-linux-pauthtest may be used with musl, and was wrongly detected
as supporting IFUNCs.

With IFUNC support now being detected more reliably, this also removes
the check for PAuth support. If both are supported, either would work.
2025-12-18 22:17:07 +00:00
Justin Bogner
c3039a7dc5
[DirectX] Avoid precalculating GEPs in DXILResourceAccess (#172720)
Instead of trying to precalculate GEP offsets ahead of time and then
process resource accesses based off of these offsets, traverse the GEP
chain inline for each access. This makes it easier to get the types
correct when translating GEPs for cbuffer and structured buffer
accesses, which in turn lets us access individual elements of those
structures directly.

Fixes #160208, #164517, and #169430
2025-12-18 22:15:12 +00:00
Florian Hahn
4c399b27c3
[LV] Add select cost test with negated condition. (NFC)
Add additional test coverage for select with negated condition.
Currently we overestimate the cost, because the negation can be folded
in the compare.
2025-12-18 22:07:06 +00:00
Erik Enikeev
4cbaa40f70
[mips][micromips] Add mayRaiseFPException to appropriate instructions, mark all instructions that read FCSR (FCR31) rounding bits as doing so (#170322) 2025-12-18 23:06:36 +01:00
Dave Lee
56db2416ff
[lldb-dap] Add missing tablegen dependency to lldb-dap (#172891)
rdar://165929985
2025-12-18 13:39:12 -08:00
Andy Kaylor
fcadb2b3da
[CIR] Combine effectively duplicate getMaskVecValue functions (#172896)
We had two functions, `getMaskVecValue` and `getBoolMaskVecValue` that
were both ported from the `GetMaskVecValue` in classic codegen.
`getBoolMaskVecValue` was bitcasting an X86 mask value to a vector of
`cir.bool` whereas `getMaskVecValue` was casting it to a vector of 1-bit
integers. While we do generally want to represent boolean values as
`cir.bool`, I don't think it makes sense to bitcast an X86 mask to a
vector of `cir.bool`. These just don't correspond.

Eliminating the boolean variant of this function also required updating
`emitX86Select` because that function was creating a `cir.select` op,
which requires a boolean argument and does not accept a vector of i1.
This probably should have been using `cir.vec.ternary` all along.
2025-12-18 13:36:58 -08:00