295831 Commits

Author SHA1 Message Date
David Green
e22985795c [AArch64] Clean up the formatting of some bitconvert patterns. NFC 2025-09-19 19:43:57 +01:00
AZero13
733c1aded1
[ARM] Replace ABS and tABS machine nodes with custom lowering (#156717)
Just do a custom lowering instead.

Also copy paste the cmov-neg fold to prevent regressions in nabs.
2025-09-19 19:43:36 +01:00
Nico Weber
6e977aabb9 [gn] port a513b701752b1 2025-09-19 14:21:30 -04:00
Wendi
fcf2c4629c
[QualGroup] Update Slides Section, Add AI Transcription Policy, Clean Up (#158842)
This patch makes the following updates to the `QualGroup.rst`
documentation:

 1. Replace slide links with Google Drive URLs

Replaced links to slide PDFs previously hosted in `llvm/docs/qual-wg/`
with publicly accessible links to the same files stored on Google Drive.

 2. Remove duplicated "Current Topics & Backlog" section

Removed an accidental duplication of the "Current Topics & Backlog"
section to improve clarity and structure.

 3. Add "AI Transcription Policy" section

Introduced a dedicated section documenting the group's practices and
expectations regarding AI-based auto-transcription during sync-up
meetings. Includes purpose, consent practices, retention details, and
how participants can opt out or raise concerns.

 4. Remove `qual-wg` subfolder from `docs`

Removed the now-unused `llvm/docs/qual-wg` directory after migrating
slide hosting off-repo. No longer needed for qualification group
documentation.

 5. Revision of the introduction

Updated sentence to reflect the most current and widely relevant safety
standards: adding IEC 61508 and IEC 62304 for broader applicability, and
replacing EN 50128 (older standard in railways) by EN 50716 for
correctness.

---------

Co-authored-by: Wendi Urribarri (Woven by Toyota <wendi.urribarri@woven-planet.global>
2025-09-19 13:16:22 -05:00
Walter Erquinigo
9ba844eb3a
[ELF][LLDB] Add an nvsass triple (#159459)
When handling CUDA ELF files via objdump or LLDB, the ELF parser in LLVM
needs to distinguish if an ELF file is sass or not, which requires a
triple for sass to exist in llvm. This patch includes all the necessary
changes for LLDB and objdump to correctly identify these files with the
correct triple.
2025-09-19 14:14:20 -04:00
Joseph Huber
2d503b924c
[LLVM] Simplify GPU runtimes flag handling (#159802)
Summary:
The AMDGPU hack can be removed, and we no longer need to skip 90% of the
`HandleLLVMOptions` if we work around NVPTX earlier. Simplifies the
interface by removing duplicated logic and keeps the GPU targets from
being weirdly divergent on some flags.
2025-09-19 13:09:52 -05:00
Stanislav Mekhanoshin
8fcb712167
[AMDGPU] gfx1250 runlines for global-atomicrmw-fadd.ll. NFC (#159817) 2025-09-19 10:58:41 -07:00
zhijian lin
2e34188513
[PowerPC] clean unused PPC target feature FeatureBPERMD (#159782)
clean unused PPC target feature FeatureBPERMD.
2025-09-19 13:38:26 -04:00
Sergei Barannikov
4cace1ff0f
[ARM] Verify that disassembled instruction is correct (#157360)
This change adds basic `MCInst` verification (checks the number of
operands) and fixes detected bugs.

* `RFE*` instructions have only one operand, but `DecodeRFEInstruction`
added two.
* `DecodeMVEModImmInstruction` and `DecodeMVEVCMP` added a `vpred`
operand, but this is what `AddThumbPredicate` normally does. This
resulted in an extra `vpred` operand.
* `DecodeMVEVADCInstruction` added an extra immediate operand.
* `getARMInstruction` added a `pred` operand to instructions that don't
have one (via `DecodePredicateOperand`).
* `AddThumb1SBit` appended an extra register operand to instructions
that don't modify CPSR (such as `tBL`).
* Instructions in `NEONDup` namespace have `pred` operand that the
generated code successfully decodes. The operand was added once again by
`getARMInstruction`/`getThumbInstruction` via `AddThumbPredicate`.

Functional changes extracted from #156540.
2025-09-19 17:37:52 +00:00
Gabriel Baraldi
21f5f32cc6
[PassBuilder] Add callback invoking to PassBuilder string API (#157153)
This is a very rough state of what this can look like, but I didn't want
to spend too much time on what could be a dead end.

Currently the only way to invoke callbacks is by using the default
pipelines, this is an issue if you want to define your own pipeline
using the C string API (we do that in LLVM.jl in julia) so I extended
the api to allow for invoking those callbacks just like one would call a
pass of that kind.

There are some questions about the params that these callbacks take and
also I'm missing some of them (some of them are also invoked by the
backend so we may not want to expose them)

Code written with AI help, bugs are mine. (Not sure what policy for this
is on LLVM)
2025-09-19 10:31:04 -07:00
Craig Topper
90d03a0386
[RISCV] Use MutableArrayRef instead of SmallVectorImpl&. NFC (#159651)
We're only going to modify existing items, not add or remove any
elements to the vector.
2025-09-19 10:21:00 -07:00
Sergei Barannikov
bf835169a5
[AArch64] Remove post-decoding instruction mutations (#156364)
Add `bits<0>` fields to instructions using the ZTR/MPR/MPR8 register
classes. These register classes contain only one register, and it is
not encoded in the instruction. This way, the generated decoder can 
completely decode instructions without having to perform a post-decoding
pass to insert missing operands.

Some immediate operands are also not encoded and have only one possible
value "zero". Use this trick for them, too.

Finally, remove `-ignore-non-decodable-operands` option from
`llvm-tblgen` invocation to ensure that non-decodable operands do not
appear in the future.
2025-09-19 17:15:38 +00:00
Sam Clegg
cac54a8ad0
[WebAssembly] Require tags for Wasm EH and Wasm SJLJ to be defined externally (#159143)
Rather then defining these tags in each object file that requires them
we can can declare them as undefined and require that they defined
externally in, for example, compiler-rt or libcxxabi.
2025-09-19 10:11:15 -07:00
Cameron McInally
8009a5bafd
[MC] Add support for -mcpu=native. (#159414)
Support -mcpu=native by querying the Host CPU Name and Feature flags.

---------

Co-authored-by: Cameron McInally <cmcinally@nvidia.com>
2025-09-19 12:43:06 -04:00
Akash Dutta
c256966fe2
[AMDGPU]: Unpack packed instructions overlapped by MFMAs post-RA scheduling (#157968)
This is a cleaned up version of PR #151704. These optimizations are now
performed post-RA scheduling.
2025-09-19 09:41:02 -07:00
Craig Topper
6119d1f115
[RISCV] Re-work how VWADD_W_VL and similar _W_VL nodes are handled in combineOp_VLToVWOp_VL. (#159205)
These instructions have one already narrow operand. Previously, we
pretended like this operand was a supported extension.

This could cause problems when we called getOrCreateExtendedOp on this
narrow operand when creating the the VWADD_VL. If the narrow operand
happened to be an extend of the opposite type, we would peek through it
and then rebuild it with the wrong extension type. So (vwadd_w_vl (i32
(sext X)), (i16 (zext Y))) would become (vwadd_vl (i16 (sext X)), (i16
(sext Y))).

To prevent this, we ignore the operand instead and pass std::nullopt for
SupportsExt to getOrCreateExtendedOp so it won't peek through any
extends on the narrow source.

Fixes #159152.
2025-09-19 09:19:57 -07:00
Michael Liao
ffb70b00f9 [RISCV] Fix build after e747223c03e16d02cd0dc6f8eedb5c825a7366c1 2025-09-19 12:11:16 -04:00
Brandon Wu
7f2dcaab39
[NFC][RISCV] Move Zvfbf* relative stuffs to RISCVInstrInfoZvfbf.td (#159619) 2025-09-19 23:57:59 +08:00
Wael Yehia
74bea4c1ad
[IR] enable attaching metadata on ifuncs (#158732)
Teach the IR parser and writer to support metadata on ifuncs, and update
documentation.

In PR #153049, we have a use case of attaching the `!associated`
metadata to an ifunc.
Since an ifunc is similar to a function declaration, it seems natural to
allow metadata on ifuncs.
Currently, the metadata API allows adding Metadata to
llvm::GlobalObject, so the in-memory IR allows for metadata on ifuncs,
but the IR reader/writer is not aware of that.

---------

Co-authored-by: Wael Yehia <wyehia@ca.ibm.com>
2025-09-19 11:41:57 -04:00
Nick Sarnie
69465ebb22
[llvm-readobj][NFC] Format ElfMachineType array definition (#159793)
Planning to add to the list in
https://github.com/llvm/llvm-project/pull/159791, so format it.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-09-19 15:35:20 +00:00
Aiden Grossman
75dba8ea9e
[lit] Add readfile substitution
This patch adds a new %{readfile:<file name>} substitution to lit. This
is needed for porting a couple of tests to lit's internal shell. These
tests are all using subshells to pass some option to a command are not
feasible to run within the internal shell without this functionality.

Reviewers: petrhosek, jh7370, ilovepi, cmtice

Reviewed By: jh7370, cmtice

Pull Request: https://github.com/llvm/llvm-project/pull/158441
2025-09-19 08:24:05 -07:00
Rahul Joshi
8109c3a27f
[LLVM] Exclude specialized lit test suites from check-all (#159781) 2025-09-19 08:10:58 -07:00
Matt Arsenault
acc156dc6f
PPC: Replace PointerLikeRegClass with RegClassByHwMode (#158777) 2025-09-19 14:46:54 +00:00
RolandF77
1eb575dcae
[PowerPC] Fix vector extend result types in BUILD_VECTOR lowering (#159398)
The result type of the vector extend intrinsics generated by the
BUILD_VECTOR lowering code should match how they are actually defined.
Currently the result type is defaulting to the operand type there. This
can conflict with calls to the same intrinsic from other paths.
2025-09-19 10:43:22 -04:00
Jeffrey Byrnes
ac8f3cdcf3 [AMDGPU] Precommit test for memory intrinics CGP handling
Change-Id: Id229f849b1d8552bbe59d6e18114042ef1614fad
2025-09-19 07:42:26 -07:00
Nico Weber
c7054d9244 [gn] port 584af2f89e95 (clang-tidy custom) 2025-09-19 10:38:46 -04:00
zhijian lin
be6c4d933d
[PowerPC] using milicode call for strlen instead of lib call (#153600)
AIX has "millicode" routines, which are functions loaded at boot time
into fixed addresses in kernel memory. This allows them to be customized
for the processor. The __strlen routine is a millicode implementation;
we use millicode for the strlen function instead of a library call to
improve performance.
2025-09-19 10:02:21 -04:00
Matt Arsenault
084872a26d
Mips: Switch to RegClassByHwMode (#158273) 2025-09-19 13:50:07 +00:00
Matt Arsenault
2654b511fe
X86: Switch to RegClassByHwMode (#158274)
Replace the target uses of PointerLikeRegClass with RegClassByHwMode
2025-09-19 13:42:00 +00:00
Mikhail Gudim
562146499c
[CodeGen][NewPM] Port ReachingDefAnalysis to new pass manager. (#159572)
In this commit:
  (1) Added new pass manager support for `ReachingDefAnalysis`.
  (2) Added printer pass.
  (3) Make old pass manager use `ReachingDefInfoWrapperPass`
2025-09-19 09:38:34 -04:00
Simon Pilgrim
188c7ed171
[X86] Add test coverage for #159670 (#159767) 2025-09-19 13:09:32 +00:00
Matt Arsenault
cc680fc50c
X86: Avoid using isArch64Bit for 64-bit checks (#157412)
Just directly check x86_64. isArch64Bit just adds extra
steps around this.
2025-09-19 12:49:13 +00:00
Matt Arsenault
9113592312
SPARC: Use RegClassByHwMode instead of PointerLikeRegClass (#158271) 2025-09-19 12:37:14 +00:00
Paul Walker
b7e4edca3d
[LLVM][CodeGen] Update PPCFastISel::SelectRet for ConstantInt based vectors. (#159331)
The current implementation assumes ConstantInt return values are scalar,
which is not true when use-constant-int-for-fixed-length-splat is
enabled.
2025-09-19 13:15:57 +01:00
Mariusz Sikora
eed99d5008
[AMDGPU] Fix the magic number RegisterClass for SReg_32 in test (#159761) 2025-09-19 14:14:33 +02:00
Rahul Joshi
13605abe07
[LLVM] Specialize test suites for TableGen and FileCheck to use smaller set of dependencies (#155929)
Define lit testsuite for FileCheck and TableGen with smaller set of
dependencies. This uses the new `SKIP` argument to `add_lit_testsuites`
that was added in https://github.com/llvm/llvm-project/pull/157176/.
2025-09-19 05:11:36 -07:00
Paul Walker
7b8fd8f31b
[LLVM][SCEV] Look through common vscale multiplicand when simplifying compares. (#141798)
My usecase is simplifying the control flow generated by LoopVectorize
when vectorising loops whose tripcount is a function of the runtime
vector length. This can be problematic because:

* CSE is a pre-LoopVectorize transform and so it's common for an IR
function to include several calls to llvm.vscale(). (NOTE: Code
generation will typically remove the duplicates)
* Pre-LoopVectorize instcombines will rewrite some multiplies as shifts.
This leads to a mismatch between VL based maths of the scalar loop and
that created for the vector loop, which prevents some obvious
simplifications.

SCEV does not suffer these issues because it effectively does CSE during
construction and shifts are represented as multiplies.
2025-09-19 12:57:13 +01:00
Hongyu Chen
fba55c89c3
[X86] Fold X * 1 + Z --> X + Z for VPMADD52L (#158516)
This patch implements the fold `lo(X * 1) + Z --> lo(X) + Z --> X iff X
== lo(X)`.
2025-09-19 19:35:05 +08:00
Raul Tambre
61166a9345
[llvm][test][CGPluginTest] Add back missing TargetParser dependency (#159760)
Din't seem to be used, but is.

    [737/738] Linking CXX executable unittests/CodeGen/CGPluginTest/CGPluginTest
    FAILED: unittests/CodeGen/CGPluginTest/CGPluginTest
    : && /usr/bin/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -Wl,--export-dynamic   -Wl,--gc-sections unittests/CodeGen/CGPluginTest/CMakeFiles/CGPluginTest.dir/PluginTest.cpp.o unittests/CodeGen/CGPluginTest/CMakeFiles/CGPluginTest.dir/Plugin/CodeGenTestPass.cpp.o -o unittests/CodeGen/CGPluginTest/CGPluginTest  -Wl,-rpath,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib  lib/libLLVMX86CodeGen.so.22.0git  lib/libLLVMX86AsmParser.so.22.0git  lib/libLLVMX86De
     sc.so.22.0git  lib/libLLVMX86Disassembler.so.22.0git  lib/libLLVMX86Info.so.22.0git  lib/libLLVMAMDGPUCodeGen.so.22.0git  lib/libLLVMAMDGPUAsmParser.so.22.0git  lib/libLLVMAMDGPUDisassembler.so.22.0git  lib/libllvm_gtest_main.so.22.0git  lib/libLLVMTestingSupport.so.22.0git  lib/libLLVMCodeGen.so.22.0git  lib/libLLVMTarget.so.22.0git  lib/libLLVMAMDGPUDesc.so.22.0git  lib/libLLVMAMDGPUInfo.so.22.0git  lib/libLLVMAMDGPUUtils.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libLLVMMC.so.22.0git  lib/libllvm_gtest.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib && :
    /usr/bin/ld: unittests/CodeGen/CGPluginTest/CMakeFiles/CGPluginTest.dir/PluginTest.cpp.o: undefined reference to symbol '_ZN4llvm6TripleC1ERKNS_5TwineES3_S3_'

Fixes: 4e1c996674cc340f290b0a528e2038e76494d8d4
2025-09-19 14:18:20 +03:00
Matt Arsenault
6b54c92be0
CodeGen: Add RegisterClass by HwMode (#158269)
This is a generalization of the LookupPtrRegClass mechanism.
AMDGPU has several use cases for swapping the register class of
instruction operands based on the subtarget, but none of them
really fit into the box of being pointer-like.

The current system requires manual management of an arbitrary integer
ID. For the AMDGPU use case, this would end up being around 40 new
entries to manage.

This just introduces the base infrastructure. I have ports of all
the target specific usage of PointerLikeRegClass ready.
2025-09-19 20:08:51 +09:00
Ryotaro Kasuga
b6231f5197
[DA] Add overflow check in ExactSIV (#157086)
This patch adds an overflow check to the `exactSIVtest` function to fix
the issue demonstrated in the test case added in #157085. This patch
only fixes one of the routines. To fully resolve the test case, the
other functions need to be addressed as well.
2025-09-19 20:08:42 +09:00
AZero13
a05e8d506b
[X86] Allow all legal integers to optimize smin with 0 (#151893)
It makes no sense why smin has to be limited to 32 and 64 bits.

hasAndNot only exists for 32 and 64 bits, so this does not affect smax.
2025-09-19 11:08:06 +00:00
Raul Tambre
4e1c996674
[llvm][test][CGPluginTest] Keep plugin in shared library directory
Scoping to the root build directory instead of using the path directly is awkward and the only such
occurrence in the test suite. It's also prone to breakage for downstreams that change the library
path.

But it's not even necessary: during build we have the appropriate RPATHs set so we can just depend
on the dynamic loader to find it. This extra logic is probably just copy-paste from PluginsTest.cpp.

Additionally:
* Removed TargetParser as a dependency because it doesn't seem to actually be used.
* Moved `add_dependencies()` to `DEPENDS` to better match the rest of LLVM.
2025-09-19 14:04:32 +03:00
Javier Lopez-Gomez
4d197c89b5
[llvm-debuginfo-analyzer] Add --output-sort=(none|id) option (#145761)
- The output for `--output-sort=id` matches `--output-sort=offset` for
the available readers. Tests were updated accordingly.

- For `--output-sort=none`, and per `LVReader::sortScopes()`,
`LVScope::sort()` is called on the root scope.
`LVScope::sort()` has no effect if `getSortFunction() == nullptr`, and
thus the elements are currently traversed in the order in which they
were initially added. This should change, however, after
`LVScope::Children` is removed.
2025-09-19 12:44:52 +02:00
Matt Arsenault
f9c996856e
cmake: Avoid using if(TARGET x AND TARGET y) (#159707)
This appears to not work, and the documentation only has
examples with a single target checked at a time.
2025-09-19 19:39:10 +09:00
LLVM GN Syncbot
9062f5e2c1 [gn build] Port b59d410202d1 2025-09-19 10:01:46 +00:00
Fabian Ritter
d5607694e1
[AMDGPU][SDAG] DAGCombine PTRADD -> disjoint OR (#146075)
If we can't fold a PTRADD's offset into its users, lowering them to
disjoint ORs is preferable: Often, a 32-bit OR instruction suffices
where we'd otherwise use a pair of 32-bit additions with carry.

This needs to be a DAGCombine (and not a selection rule) because its
main purpose is to enable subsequent DAGCombines for bitwise operations.
We don't want to just turn PTRADDs into disjoint ORs whenever that's
sound because this transform loses the information that the operation
implements pointer arithmetic, which AMDGPU for instance needs when
folding constant offsets.

For SWDEV-516125.
2025-09-19 11:58:41 +02:00
Sven van Haastregt
91dba2201e
Fix NDEBUG Wundef warning; NFC (#159539)
The `NDEBUG` macro is tested for defined-ness everywhere else. The
instance here triggers a warning when compiling with `-Wundef`.
2025-09-19 11:51:31 +02:00
UmeshKalappa
b59d410202
RISC-V: builtins support for MIPS RV64 P8700 execution control .
the following changes are made 

a)Typo Fix (with previous PRhttps://github.com/llvm/llvm-project/pull/155747)
b)builtins support  for MIPS P8700 execution control instructions .
c)Testcase
2025-09-19 15:10:28 +05:30
Fabian Ritter
771c94c8db
[SDAG][AMDGPU] Allow opting in to OOB-generating PTRADD transforms (#146074)
This PR adds a TargetLowering hook, canTransformPtrArithOutOfBounds,
that targets can use to allow transformations to introduce out-of-bounds
pointer arithmetic. It also moves two such transformations from the
AMDGPU-specific DAG combines to the generic DAGCombiner.

This is motivated by target features like AArch64's checked pointer
arithmetic, CPA, which does not tolerate the introduction of
out-of-bounds pointer arithmetic.
2025-09-19 11:07:59 +02:00