Commit Graph

555637 Commits

Author SHA1 Message Date
Lang Hames
28b3f2f04b [orc-rt] Add SPSExecutorAddr <-> T* serialization. (#162992)
This replaces SPS transparent conversion for pointers. Transparent
conversion only applies to argument/return types, not nested types. We
want to be able to serialize / deserialize structs containing pointers.

We may need to replace this in the near future with a new SPSPointer tag
type, since SPSExecutorAddr is meant to be serialization for pure
addresses, and pointers may carry other information (e.g. tag bits), but
we can do that in a follow-up commit.
2025-10-11 22:24:03 +11:00
Twice
24ac5066dd [MLIR][NFC] Clean up rewrite CAPI implementation and Python bindings (#162974)
This is a follow-up PR of #162699.

In this PR we clean CAPI and Python bindings of MLIR rewrite part by:
- remove all manually-defined `wrap`/`unwrap` functions;
- remove useless nanobind-defined Python class `RewritePattern`.
2025-10-11 19:11:20 +08:00
Younan Zhang
688cbe41ca [Clang] Fix a bug when checking non-dependent constraints (#162969)
We check the non-dependent constraints early with empty template
arguments when we build a nested requirement. Therefore we cannot assume
a non-empty MLTAL within the Checker.

No release note because this is a regression on trunk.
2025-10-11 16:20:34 +08:00
lonely eagle
5a05fa1f7d [mlir][bufferize] Delete getCalledFunction in drop-equivalent-buffer-results pass (NFC) (#162432)
Use resolveCallable replace getCalledFunction.
2025-10-11 16:12:27 +08:00
LeeYoungJoon
885d416337 [QualGroup][docs] Add new members to LLVM Qualification Working Group (#161113)
## Summary

This PR adds three new members to the LLVM Qualification Working Group
member table in the documentation.

## Changes

- **Jorge Pinto Sousa** (Critical Techworks)
- **José Rui Simões** (Critical Software)
- **Zaky Hermawan** (Individual contributor)

## Background

These new members have been nominated and approved through the working
group's established nomination process as outlined in the QualGroup
documentation. They meet the membership criteria for individuals with
relevant experience in qualification-related efforts.

## Testing

- [x] Documentation builds successfully
- [x] Member table formatting is correct
- [x] All links and handles are properly formatted

## Related Links

- [LLVM Qualification Working Group
Documentation](https://llvm.org/docs/QualGroup.html)
2025-10-11 15:50:20 +09:00
Dharuni R Acharya
53c785d859 [NFC][MLIR] Refactor NVVM_CpAsyncBulkGlobalToSharedClusterOp's lowering (#162611) 2025-10-11 07:40:40 +02:00
Matt Arsenault
24d5c4ff75 AtomicExpand: Switch X86 test to generated checks (#162968) 2025-10-11 04:40:33 +00:00
Craig Topper
0746ff319e [RISCV] Explicitly use i32 in RV32 Zdinx patterns to prune tablegen patterns. NFC (#162790)
Tablegen was creating unnecessary patterns for the RV64 HwMode.
2025-10-10 21:34:45 -07:00
Mircea Trofin
3f84e162cc [profcheck] remove tests failing because of LIT_USE_INTERNAL_DIFFERENCES (#162967)
Issue #162966
2025-10-10 21:07:14 -07:00
AZero13
07eeb5f08d [PowerPC] Lower ucmp using subtractions (#146446)
Source: Hacker's delight, page 21.

Using the carry, we can use contractions to use the ucmp.
2025-10-11 12:34:30 +09:00
Twice
7aec3f2864 [MLIR][Python] Support Python-defined rewrite patterns (#162699)
This PR adds support for defining custom **`RewritePattern`**
implementations directly in the Python bindings.

Previously, users could define similar patterns using the PDL dialect’s
bindings. However, for more complex patterns, this often required
writing multiple Python callbacks as PDL native constraints or rewrite
functions, which made the overall logic less intuitive—though it could
be more performant than a pure Python implementation (especially for
simple patterns).

With this change, we introduce an additional, straightforward way to
define patterns purely in Python, complementing the existing PDL-based
approach.

### Example

```python
def to_muli(op, rewriter):
    with rewriter.ip:
        new_op = arith.muli(op.operands[0], op.operands[1], loc=op.location)
    rewriter.replace_op(op, new_op.owner)

with Context():
    patterns = RewritePatternSet()
    patterns.add(arith.AddIOp, to_muli) # a pattern that rewrites arith.addi to arith.muli
    frozen = patterns.freeze()

    module = ...
    apply_patterns_and_fold_greedily(module, frozen)
```

---------

Co-authored-by: Maksim Levental <maksim.levental@gmail.com>
2025-10-11 11:28:45 +08:00
Yingwei Zheng
0b462f6f83 [ConstantFPRange] Add support for cast operations (#162686)
This patch adds support for fpext/fptrunc operations.

I noticed that finite-only semantics are not supported by the current
representation of constant FP ranges. It should be okay for now, as we
don't expose these types in the IR.
2025-10-11 02:47:11 +00:00
Mircea Trofin
d7e7cd0541 [profcheck] Update xfail list (#162912)
Cleanup after a bunch of work landed.
2025-10-10 19:41:08 -07:00
Lei Wang
8a598f1044 [NFC] Simplify checks using isDebugOrPseudoInstr API (#145127)
Merge the two checks using the existing API, NFC.
2025-10-11 11:30:22 +09:00
beetrees
11571a005a Fix legalizing FNEG and FABS with TypeSoftPromoteHalf (#156343)
Based on top of #157211.

`FNEG` and `FABS` must preserve signalling NaNs, meaning they should not
convert to f32 to perform the operation. Instead legalize to `XOR` and
`AND`.

Fixes almost all of #104915
2025-10-11 11:08:26 +09:00
Joseph Huber
c18de24d9d [libc] Add a config option to disable slab reclaiming (#151599)
Summary:
Without slab reclaiming this interface is much simpler and it can speed
up cases with a lot of churn. Basically, wastes memory for performance.
2025-10-10 21:05:51 -05:00
Yingwei Zheng
9e63b7ae4c [InstCombine] Fix flag propagation in foldSelectIntoOp (#162003)
Consider the following transform:
```
C = binop float A, nnan OOp
D = select ninf, i1 cond, float C, float A
->
E = select ninf, i1 cond, float OOp, float Identity
F = binop float A, E
```
We cannot propagate ninf from the original select, because OOp may be
inf, and the flag only guarantees that FalseVal (op OOp) is never
infinity.
Examples: -inf + +inf = NaN, -inf - -inf = NaN, 0 * inf = NaN
Specifically, if the original select has both ninf and nnan, we can
safely propagate the flag.

Alive2: 
+ fadd: https://alive2.llvm.org/ce/z/TWfktv
+ fsub: https://alive2.llvm.org/ce/z/RAsjJb
+ fmul: https://alive2.llvm.org/ce/z/8eg4ND

Closes https://github.com/llvm/llvm-project/issues/161634.
2025-10-11 10:04:55 +08:00
Matheus Izvekov
4cc0bae159 [clang] fix getReplacedTemplateParameter for partial specialziations (#162955)
The template argument returned should be relative to the partial
specialization, which would correspond to the partial template parameter
list.

Unfortunately we don't save this anywhere in the AST, and would
otherwise need to deduce them again.

Simply avoid providing this argument for now, until we make it
available.

This fixes regressions which were never released, so there are no
release notes.

Fixes #162770
Fixes #162855
2025-10-10 23:00:36 -03:00
AZero13
d95f8ffee4 [ARM][TargetLowering] Combine Level should not be a factor in shouldFoldConstantShiftPairToMask (NFC) (#156949)
This should be based on the type and instructions, and only thumb uses
combine level anyway.
2025-10-11 10:58:48 +09:00
Mingjie Xu
26eca2439c Move the preserve-{bc,ll}-uselistorder options out of individual tools, make them global defaults for AsmWriter and BitcodeWriter (#160079)
This patch moves the `preserve-bc-uselistorder` and
`preserve-ll-uselistorder` options out of individual tools(opt, llvm-as,
llvm-dis, llvm-link, llvm-extract) and make them global defaults for
AsmWriter and BitcodeWriter.

These options are useful when we use `-print-*` options to dump LLVM IR.
2025-10-11 09:19:50 +08:00
Twice
19b9b54158 [MLIR][Docs] Add docs for Python-defined pass in Python bindings (#162833)
Python-defined passes have been merged into the main branch for some
time now. I believe adding a corresponding section in the documentation
will help more users learn about this feature and understand how to use
it.

This PR adds such a section to the docs of Python bindings, summarizing
the feature and providing an example.
2025-10-11 09:04:02 +08:00
Scott Pillow
cb4fdc0010 [Support] Fix thread safety issue in raw_null_ostream (#162787)
The global raw_null_ostream singleton returned by llvm::nulls() is
marked as InternalBuffer rather than Unbuffered, causing it to
allocate a buffer when first written to. In multithreaded environments,
multiple threads can simultaneously trigger buffer allocation via
SetBuffered(), leading to race conditions on the buffer pointer
fields (OutBufCur, OutBufEnd).

For example:

raw_ostream::write(const char *Ptr, size_t Size)
->
raw_ostream::SetBuffered()
->
raw_ostream::SetBufferSize(size_t Size)
->
raw_ostream::SetBufferAndMode(char *BufferStart, size_t Size,
                              BufferKind Mode)

This can manifest as a heap corruption when multiple threads write to
the
null stream concurrently, as the buffer pointers will become corrupted
during the race.

The fix is to explicitly pass Unbuffered=true to the raw_pwrite_stream
constructor, ensuring the null stream never allocates a buffer and
all writes go directly to the no-op write_impl().

For example, this can fix multithreaded applications using MCELFStreamer
where getCommentOS() returns the shared nulls() singleton.
2025-10-10 21:02:46 -04:00
Kaitlin Peng
720007e4b7 [NFC] [SPIRV] Add SPIRVCombinerHelper and refactor pre legalizer combiner to use it (#162735)
Lots of the code/structure was based off `AMDGPUCombinerHelper`,
`AMDGPUPreLegalizerCombiner`, etc.

Tasks completed:
- Create new `SPIRVCombinerHelper` inheriting from `CombinerHelper`
- Move combiner logic in `SPIRVPreLegalizerCombiner` to helper methods
in `SPIRVCombinerHelper`
- Update `SPIRVPreLegalizerCombiner` to use the new helper class
- Simplify `applySPIRVDistance` code
2025-10-11 09:29:07 +09:00
Chengjun
8faeed042a [SROA] Add Stored Value Size Check for Tree-Structured Merge (#162921)
The change fixes a bug in the SROA where tree-structured merge
optimization was incorrectly applied when the size of the stored value
was not a multiple of the new allocated element type size. The original
change is https://github.com/llvm/llvm-project/pull/152793. A simple
repro would be

```
define <1 x i32> @foo(<1 x i16> %a, <1 x i16> %b) {
entry:
  %alloca = alloca [1 x i32]

  %ptr0 = getelementptr inbounds [2 x i16], ptr %alloca, i32 0, i32 0
  store <1 x i16> %a, ptr %ptr0

  %ptr1 = getelementptr inbounds [2 x i16], ptr %alloca, i32 0, i32 1
  store <1 x i16> %b, ptr %ptr1

  %result = load <1 x i32>, ptr %alloca
  ret <1 x i32> %result
}
```

Currently, this will lead to a compile time crash.

In this change, we will skip the tree-structured merge for this case and
fall back to normal SROA.
2025-10-11 00:23:04 +00:00
Alexey Bataev
d3233e806e [SLP]Do not allow undefs being combined with divs
Undefs/poisons with divs in vector operations lead to undefined
behavior, disabling this combination

Fixes #162663
2025-10-10 16:59:05 -07:00
Lang Hames
27e2d5c46f [orc-rt] Align SimpleNativeMemoryMap Segment with LLVM type. (#162823)
This commit aims to align SimpleNativeMemoryMap::FinalizeRequest::Segment with
llvm::orc::tpctypes::SegFinalizeRequest. This will simplify construction of a
new LLVM JITLinkMemoryManager that's capable of using SimpleNativeMemoryMap as
a backend.
2025-10-11 10:33:28 +11:00
Mingming Liu
0aef9ebc14 [NFC] Pre-commit test case for https://github.com/llvm/llvm-project/pull/162348 (#162938) 2025-10-10 23:10:26 +00:00
Reid Kleckner
56e3e30ceb [clang] Remove -g[no-]-* bool flags from g_Group (#162750)
There are four uses of BoolGOption, and all of them are essentially debug
info feature flags, which I believe should not the enablement or
disablement of all debug info emission. `OPT_g_group` is used to control
the debug info level here:

https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Clang.cpp#L4387

This doesn't cause any test failures, and seems like the right behavior
for all four flags:
* -g[no-]flag-base
* -g[no-]inline-line-tables
* -g[no-]key-instructions
* -g[no-]structor-decl-linkage-names

None of these, even in the positive form, should enable debug info
emission.

Fixes #162747
2025-10-10 22:49:18 +00:00
Valentin Clement (バレンタイン クレメン)
1a8057fd47 [flang][cuda] Add interface and lower barrier_init (#162929)
Add interface for `barrier_init` and lower it to the NVVM Op. 

https://github.com/clementval/llvm-project/pull/new/cuf_barrier_init
2025-10-10 22:48:27 +00:00
Md Abdullah Shahneous Bari
b92483c42c Revert "[MLIR][Math][XeVM] Add MathToXeVM (math-to-xevm) pass" (#162923)
Reverts llvm/llvm-project#159878
2025-10-10 17:06:36 -05:00
Arjun Ramesh
7e7c923b58 [WebAssembly] Support for new target wasm32-linux-muslwali (#162581)
Add toolchain support for the
[WALI](https://doc.rust-lang.org/rustc/platform-support/wasm32-wali-linux.html)
target as per its corresponding
[RFC](https://discourse.llvm.org/t/rfc-new-wasm-linux-target-support/88203)
2025-10-10 14:54:25 -07:00
Rahul Joshi
a4a0a4b9b1 [NFC][LLVM] Code cleanup in InstructionNamer.cpp (#162689)
Make file local function static and use explicit type for Arg.
2025-10-10 14:42:05 -07:00
Cyndy Ishida
44c5dabea3 [clang-installapi] Add test for -Xproject -fvisibility=* (#162908) 2025-10-10 14:39:44 -07:00
Erich Keane
8d9aecce06 Revert "[OpenACC] Sema changes for +*&|^ reduction combiner recipes (… (#162920)
…#162740)"

This reverts commit 6010df0402.

This apparently fails some sanitizer test as reported here:
https://github.com/llvm/llvm-project/pull/162740

It isn't really clear where this happens, but reverting as it is a
friday, and I have no idea if I'll be able to repro this anytime soon,
  let alone fix it.
2025-10-10 21:26:34 +00:00
Mikhail Gudim
004270d247 [RISCV][SLP][NFC]Add a test for satd-8x4 from x264 benchmark. (#162542)
Precommit a test.
2025-10-10 21:25:37 +00:00
Ian Li
fabd1c418a [MLIR][Math][XeVM] Add MathToXeVM (math-to-xevm) pass (#159878)
This PR introduces a `MathToXeVM` pass, which implements support for the
`afn` fastmath flag for SPIRV/XeVM targets - It takes supported `Math`
Ops with the `afn` flag, and converts them to function calls to OpenCL
`native_` intrinsics.

These intrinsic functions are supported by the SPIRV backend, and are
automatically converted to `OpExtInst` calls to `native_` ops from the
OpenCL SPIRV ext. inst. set when outputting to SPIRV/XeVM.

Note:
- This pass also supports converting `arith.divf` to native equivalents.
There is an option provided in the pass to turn this behavior off.
- This pass preserves fastmath flags, but these flags are currently
ignored by the SPIRV backend. Thus, in order to generate SPIRV that
truly preserves fastmath flags, support needs to be added to the SPIRV
backend.
2025-10-10 16:03:58 -05:00
Mikhail Gudim
d78c93077b [SLPVectorizer] Move size checks (NFC). (#161867)
Add the `analyzeRtStrideCandidate` function. In the future commits we're
going to add the capability to widen strided loads to it. So, in this
commit, we move the size / type checks into it, since it can possibly
change size / type of load.
2025-10-10 20:52:17 +00:00
Jason Molenda
190886ddc9 [lldb][NFC] enable unwind logging in TestCortexMExceptionUnwind
Still seeing a failure on a CI bot with this test that
I cannot reproduce locally, but luckily this one CI bot is giving
me trace output from the tests.  Turn on the unwind log when tracing
is enabled, migth get a better hint what's up with this test fail.
2025-10-10 13:50:45 -07:00
Erick Velez
3af43e303c [clang-doc] simplify filename selection for namespaces (#162885)
determineFileName was confusing regarding namespaces. The comment and
conditional were both misleading. Now, we just check against a static
global namespace USR to make a file use "index", or just use the name.
2025-10-10 13:34:11 -07:00
Tom Stellard
9f0f6e8dda workflows/release-binaries: Run tests on the same runner as the build (#162421)
Also, ignore the test results since they almost always fail. This allows
us to simplify the build process and skip uploading and downloading the
build and source directories which are huge.
2025-10-10 12:58:24 -07:00
Nico Weber
2084655d1e Revert "[gn build] Port 2eb8c47b88e8"
This reverts commit a833d902ae.
2eb8c47b88 was reverted in 24a5d8a9ca
2025-10-10 15:45:34 -04:00
Farzon Lotfi
28c5a2c46d [Clang][HLSL][GVN] Prevent phi codgen of isTokenLike types (#162363)
fixes #161754

When the GVN pass calls `PerformLoadPRE` or `processNonLocalLoad` it can
invoke the `SSAUpdater` which adds a phi node for our tokenLike type. If
we check for if the load is on a token like type at the `processLoad` we
can cover both cases. This is because if we don't GVN will use the
SSAUpdater to insert a phi node to reduce duplicate resource.getpointer
calls.

Because in an earlier commit:
01c0a8409a
we made the verifier error with `PHI nodes cannot have token type!`

This test case will fail today if we try to perform this load
optimization
https://godbolt.org/z/xM69fY8zM

This will impact clang aswell because `isTokenLikeTy` also checks for
`isTokenTy` Clang is likely also failing validation with token types but
just doesn't have a test case because the validator would error if it
were in a phi node.
2025-10-10 15:38:24 -04:00
James Y Knight
bd3ddcf7e1 Bazel: fix after [mlir][amdgpu] Add Inliner interface (#162873) 2025-10-10 15:24:57 -04:00
Erich Keane
6010df0402 [OpenACC] Sema changes for +*&|^ reduction combiner recipes (#162740)
As a followup to the previous AST changes, the next step is to generate
the proper expressions in Sema. This patch does so for +,*,&,|,^ by
modeling them as compound operators.

This also causes the legality of some expressions to change, as these
have to be legal operations, but were previously unchecked, so there are
some test changes.

This does not yet generate any CIR, that will happen in the next patch.
2025-10-10 19:22:55 +00:00
Prabhu Rajasekaran
6fb87b231f [llvm][AsmPrinter] Call graph section format. (#159866)
Make .callgraph section's layout efficient in space. Document the layout
of the section.
2025-10-10 12:20:11 -07:00
Andy Kaylor
b3f2d93766 [CIR] Add lowering support for dynamic cast (#162715)
This adds support for lowering cir.dyn_cast operations to a form that
can be lowered to LLVM IR.
2025-10-10 12:09:29 -07:00
Michael Buch
312f1fa8f2 [llvm][DebugInfo][test] DwarfTest: parameterize LanguageDescription tests (#162863)
Better test coverage.

The round-tripping test makes sure that if we ever change
`llvm::dwarf::toDW_Lang` or `llvm::dwarf::toDW_LName`, we don't break
the `LanguageDescription` API.

The round-tripping test found an incorrect version check in
`llvm::dwarf::toDW_Lang`, which I corrected as part of this PR (see the
table at the bottom of https://dwarfstd.org/languages-v6.html for
reference).
2025-10-10 20:07:21 +01:00
Michael Buch
24feeb2013 [llvm][test] Don't specify target for tests in Generic directory
Fixes buildbot failures where no arm64 target was available.
2025-10-10 19:53:02 +01:00
Erich Keane
41f5f3be30 [OpenACC] Fix uses of getBaseOriginalType when we really want elt type. (#162880)
Lately, I've been using 'getBaseOriginalType' in ArraySectionExpr
incorrectly: it gets the base-ist of element type, when in reality, I
want a single type of indirection. This patch corrects the handful of
uses that I had for it.
2025-10-10 18:41:41 +00:00
Ivan Butygin
6ad662d322 [mlir][amdgpu] Add Inliner interface (#162873)
All the `amdgpu` dialect ops can be inlined.

---------

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
2025-10-10 21:34:00 +03:00