287339 Commits

Author SHA1 Message Date
Justin Bogner
ae34440834
[DirectX] Make DXILOpLowering responsible for cleaning up dead intrinsics (#138199)
This moves the responsibility for cleaning up dead intrinsics from
DXILFinalizeLinkage to DXILOpLowering, and moves DXILFinalizeLinkage
back to it's pre-#136244 place in the pipeline. Doing this avoids issues
with DXIL passes running on obviously dead code, and makes it more clear
what DXILFinalizeLinkage is really doing.

This also helps with the story for #134260, as cleaning up dead
intrinsics doesn't make sense if this becomes a more generic pass.

Note that test/CodeGen/DirectX/remove-dead-intriniscs.ll already covers
most of the testing here. It'd be nice to have something that catches
the regression from changing the pass ordering but I couldn't come up
with anything that wouldn't be incredibly fragile.

Fixes #138180.
2025-05-01 22:07:07 -07:00
Snehasish Kumar
099a0fa3f2
[MemProf] Add v4 which contains CalleeGuids to CallSiteInfo. (#137394)
This patch adds CalleeGuids to the serialized format and increments the version number to 4. The unit tests are updated to include a new test for v4 and the YAML format is also updated to be able to roundtrip the v4 format.
2025-05-01 20:17:21 -07:00
Jim Lin
f46ff4c204 [NFC][regalloc] Fix typo in llvm/lib/CodeGen/AllocationOrder.h. 2025-05-02 10:11:34 +08:00
Luke Lau
aa6d541065
[InstSimplify] Fold {u,s}{min,max} x, poison -> poison (#138166)
Following from the discussion in
https://github.com/llvm/llvm-project/pull/138095#discussion_r2070484664,
these intrinsics are poison if any of their operands are poison, and are
marked as such in propagatesPoison in ValueTracking.cpp.

This will help fold away leftover vectors produced by VectorCombine when
scalarizing intrinsics.
2025-05-02 07:49:27 +08:00
Alexey Bataev
9400270449 [SLP]Fix comparator for vector operands of extractelements in PHICompare
Need to make comparator to follow strict-weak ordering to fix compiler
crashes.

Fixes #138178
2025-05-01 14:28:20 -07:00
Yingwei Zheng
c37b2549ff
Revert "[InstSimplify] Fold getelementptr inbounds null, idx -> null (#130742)" (#138168)
Revert #130742 for now to avoid breaking glibc failures until the
workaround patches are landed.
2025-05-01 14:21:59 -07:00
Florian Hahn
8d02529f77
[VPlan] Consistently use ArrayRef<VPValue *> for operands in ctors (NFC) (#137798)
Now that there is an ArrayRef constructor taking iterator_ranges, use it
consistently to slightly simplify code.

Depends on https://github.com/llvm/llvm-project/pull/137796.

PR: https://github.com/llvm/llvm-project/pull/137798
2025-05-01 21:19:10 +01:00
Alex MacLean
978df3b9f1
[NVPTX][test] Fixup to get ptxas passing for byval-const-global.ll (#138175) 2025-05-01 12:38:39 -07:00
Jay Foad
c2bec64833
[AMDGPU] Simplify GCNTTIImpl::isValidAddrSpaceCast. NFCI. (#137986)
This just removes some code that references specific address spaces.
2025-05-01 20:18:48 +01:00
Ahmed Bougacha
1f56afa9b4 [InlineSpiller] Fix missing LiveRegMatrix declaration. NFC.
b25b51eb639d adds a reference to LiveRegMatrix in Spiller.h without
including the header, or adding a declaration.  That breaks modules
builds.

It looks like it might get reverted in #137801, but let's fix the
breakage in the meantime.
2025-05-01 11:40:07 -07:00
Krzysztof Parzyszek
760bba4666
[flang][OpenMP] Allow UPDATE clause to not have any arguments (#137521)
The UPDATE clause can be specified on both ATOMIC and DEPOBJ directives.
Currently, the ATOMIC directive has its own handling of it, and the
definition of the UPDATE clause only supports its use in the DEPOBJ
directive, where it takes a dependence-type as an argument.

The UPDATE clause on the ATOMIC directive may not have any arguments.
Since the implementation of the ATOMIC construct will be modified to use
the standard handling of clauses, the definition of UPDATE should
reflect that.
2025-05-01 13:30:45 -05:00
Shilei Tian
cf9d4048fb Reapply "[NFC][AMDGPU] Correct the check line update script for llvm/test/CodeGen/AMDGPU/attributor-flatscratchinit-undefined-behavior.ll"
This reverts commit 74f55c744a18b848cc780c42f0e3dde7e7c96195 with a fix for the
check lines.
2025-05-01 14:13:23 -04:00
Shilei Tian
74f55c744a Revert "[NFC][AMDGPU] Correct the check line update script for llvm/test/CodeGen/AMDGPU/attributor-flatscratchinit-undefined-behavior.ll"
This reverts commit 49a5dd3dac285ba12f3fcaa55cacbea5968f5a37.
2025-05-01 14:12:03 -04:00
Shilei Tian
49a5dd3dac [NFC][AMDGPU] Correct the check line update script for llvm/test/CodeGen/AMDGPU/attributor-flatscratchinit-undefined-behavior.ll 2025-05-01 14:10:46 -04:00
Shilei Tian
e25ddf9081 [NFC][AMDGPU] Auto generate check lines for llvm/test/CodeGen/AMDGPU/inline-attr.ll 2025-05-01 13:52:27 -04:00
David Truby
0a4be7898a
[flang] Move LLVM_ENABLE_RUNTIMES definition above uses (#138136) 2025-05-01 18:45:43 +01:00
Alex MacLean
a88d580860
[NVPTX] Pull invariant load identification into IR pass (#138015)
Pull invariant load identification, which was previously part of
DAGToDAG ISel, into a new IR pass NVPTXTagInvariantLoads. This makes it
possible to disable this optimization at O0 and reduces the complexity
of the SelectionDAG pass. Moving this logic to an IR pass also allows
for implementing a more powerful traversal in the future.

Fixes https://github.com/llvm/llvm-project/issues/138138
2025-05-01 10:19:46 -07:00
Rahul Joshi
f24606376d
[NFC][LLVM][CodeGen] Refactor MIR Printer (#137361)
- Move `MIPrinter` class to anonymous namespace, and remove it as a
friend of `MachineBasicBlock`.
- Move `canPredictBranchProbabilities` to `MachineBasicBlock` and change
it to use the new `BranchProbability::normalizeProbabilities` function
that accepts a range, and also to use `llvm::equal()` to check equality
of the two vectors.
- Use `ListSeparator` to print comma separate lists instead of manual
code to do that.
2025-05-01 10:00:54 -07:00
Anshil Gandhi
dadd91e793
[NFC] Precommit tests for an LSV patch (#138167)
Autogenerate checks for merge-vectors.ll and introduce
merge-vectors-complex.ll with mismatched types.
Related PR: https://github.com/llvm/llvm-project/pull/134436

This is a reland of https://github.com/llvm/llvm-project/pull/138155,
which was reverted due to missed nits.
2025-05-01 12:50:31 -04:00
Anshil Gandhi
a7aca819d4
Revert "[NFC] Precommit: Autogenerate checks for an LSV test" (#138161)
Reverts llvm/llvm-project#138155
2025-05-01 12:09:51 -04:00
Anshil Gandhi
0e9740ea17
[NFC] Precommit: Autogenerate checks for an LSV test (#138155)
Related PR: https://github.com/llvm/llvm-project/pull/134436
2025-05-01 12:00:43 -04:00
David Spickett
09488bcfba
[lldb] Disable statusline on Windows (#138111)
Something to do with control code handling in Windows terminals breaks
the statusline in various ways. It makes LLDB unusable and even if you
set the setting to disable statusline, it's too late, and the terminal
session is now in a weird state.

See https://github.com/llvm/llvm-project/issues/134846 for more details.

Until we figure this out, don't allow it to be used on Windows.
2025-05-01 16:40:47 +01:00
NimishMishra
c617466501
[flang][llvm][OpenMP] Add implicit casts to omp.atomic (#131603)
Currently, implicit casts in Fortran are handled by the OMPIRBuilder.
This patch shifts that responsibility to FIR codegen.
2025-05-01 08:20:42 -07:00
Philip Reames
2bb2f8ab49
[CodeGen] Remove experimental deferred spilling from GreedyRegAlloc (#137850)
This experimental option was introduced in 2015 via commit 1192294, and
the target hook was added in 2020 via commit 99e865b6. There does not
appear to have ever been a use of this target hook in tree.

This code is complicating one of the most complicated and hard to
understand parts of our code base, and was an experiment introduced
nearly 10 years ago. Let's get rid of it.

Note that the idea described in the original patch is not neccessarily a
bad one, and we might return to it someday.
2025-05-01 08:11:51 -07:00
Sam Tebbs
2876dbcd66
[AArch64] Don't allow mixed partial reductions without i8mm (#137602)
Partial reductions with mixed extends should only be allowed if i8mm is
present.
2025-05-01 16:06:37 +01:00
David Green
abd2c07e39
[CostModel] Make Op0 and Op1 const in getVectorInstrCost. NFC (#137631)
This does not alter much at the moment, but allows const pointers to be
passed as Op0 and Op1, simplifying later patches
2025-05-01 15:55:08 +01:00
Philip Reames
38c2833701 [RISCV] Use early return to simplify VLA shuffle lowering [nfc] 2025-05-01 07:47:27 -07:00
Rahul Joshi
64f552cefa
[NFC][LLVM][CodeGen] Refactor MachineInstr operand accessors (#137261)
- Change MachineInstr operand accessors to use `ArrayRef` internally to
slice the operand array into sub-arrays.
- Minor: remove unnecessary {} on `MachineInstrBuilder::add`.
2025-05-01 07:45:22 -07:00
Orlando Cazalet-Hyams
0c7c82af23
[KeyInstr] Add fields to DILocation behind compile time flag (#133477)
Add AtomGroup and AtomRank to DILocation behind compile time flag
EXPERIMENTAL_KEY_INSTRUCTIONS which is controlled by cmake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS.

Add IR read-write roundtrip test in a directory that is unsupported unless the
CMake flag is enabled.

RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-01 15:40:39 +01:00
Luke Lau
d33c676468
[ConstantFolding] Constify ConstantFoldInstOperands and ConstantFoldInstruction argument. NFC (#138108)
I tried to use these with a const reference in a separate patch, but the
pointers weren't marked as const. It turns out that these don't mutate
the instruction.
2025-05-01 22:39:37 +08:00
Vlad Serebrennikov
b877cfa8f2
[ADT] Remove is_scoped_enum_v (#138134)
`std::underlying_type` is not SFINAE-friendly in Clang and GCC before 9,
and it's too much of a hassle to make it work. Instead, I'm inlining the
implementation in the only place it's needed. Fixes buildbot failure
https://lab.llvm.org/buildbot/#/builders/134/builds/17904 caused by
#138089. Demo: https://godbolt.org/z/9qo3csP98
2025-05-01 18:37:23 +04:00
Nicholas Guy
b6f65f07bc
[SelectionDAG] Improve type legalisation for PARTIAL_REDUCE_MLA (#130935)
Implement proper splitting functions for PARTIAL_REDUCE_MLA ISD nodes.
This makes the udot_8to64 and sdot_8to64 tests generate dot product
instructions for when the new ISD nodes are used.

---------

Co-authored-by: James Chesterman <james.chesterman@arm.com>
2025-05-01 15:08:46 +01:00
Vlad Serebrennikov
001cc34275
[clang] Add scoped enum support to StreamingDiagnostic (#138089)
This patch adds templated `operator<<` for diagnostics that pass scoped
enums, saving people from `llvm::to_underlying()` clutter on the side of
emitting the diagnostic. This eliminates 80 out of 220 usages of
`llvm::to_underlying()` in Clang.

I also backported `std::is_scoped_enum_v` from C++23.
2025-05-01 17:03:47 +04:00
Alex Bradbury
3376071a24 [RISCV][NFC] Add missed // clang-format on
clang-format was turned off for the defines, but there was no matching
`// clang-format on` comment at the end. Ran into this in #137973
2025-05-01 13:37:49 +01:00
Martin Storsjö
724eea7654
[llvm][test] Change an XFAIL into a more correct REQUIRES (#137942)
As this test is about executing x86_64 code with "lli", we should only
try to do it if we actually execute on an x86_64 target. So instead of
XFAILing individual architectures that can't execute it, instead change
this into requiring an x86_64 target.

Also generalize the target triple form used; don't assume that the
vendor field is set to "pc" - many mingw toolchains use the vendor field
set to "w64".
2025-05-01 15:27:29 +03:00
Paul Walker
149d795ab0
[LLVM][InstCombine] Enable constant folding for SVE sdiv & udiv intrinsics. (#137966) 2025-05-01 13:20:05 +01:00
Paul Walker
0fab741a26
[LLVM][CodeGen][AArch64] Don't scalarise v8{f16,bf16} vsetcc operations. (#135398)
I have also removed custom promotion code for the v4{f16,bf16} cases
because the same common code can be used.
2025-05-01 13:06:39 +01:00
Carl Ritson
3015edf96e
[cmake] Pass LLVM_TABLEGEN_FLAGS to cross compile targets (#138086)
If ValueTypes.td contains conditional directives enabled by defs in
LLVM_TABLEGEN_FLAGS then native build tblgen and min-tblgen must be
built with matching flags.
This ensures the embedded types in TableGen are consistent with those
used for building tables.
2025-05-01 20:49:22 +09:00
Matt Arsenault
79b841df75
Assembler: Replace some usage of grep in tests with FileCheck (#138114) 2025-05-01 13:45:20 +02:00
Matt Arsenault
9494464b13
Verifier: Move test from Assembler to right place and avoid grep (#138113) 2025-05-01 13:44:49 +02:00
Lucas Ramirez
e377dc4d38
[AMDGPU] Max. WG size-induced occupancy limits max. waves/EU (#137807)
The default maximum waves/EU returned by the family of
`AMDGPUSubtarget::getWavesPerEU` is currently the maximum number of
waves/EU supported by the subtarget (only a valid occupancy range in
"amdgpu-waves-per-eu" may lower that maximum). This ignores maximum
achievable occupancy imposed by flat workgroup size and LDS usage,
resulting in situations where `AMDGPUSubtarget::getWavesPerEU` produces
a maximum higher than the one from
`AMDGPUSubtarget::getOccupancyWithWorkGroupSizes`.

This limits the waves/EU range's maximum to the maximum achievable
occupancy derived from flat workgroup sizes and LDS usage. This only has
an impact on functions which restrict flat workgroup size with
"amdgpu-flat-work-group-size", since the default range of flat workgroup
sizes achieves the maximum number of waves/EU supported by the
subtarget.

Improvements to the handling of "amdgpu-waves-per-eu" are left for a
follow up PR (e.g., I think the attribute should be able to lower the
full range of waves/EU produced by these methods).
2025-05-01 13:22:23 +02:00
Matt Arsenault
21aa7b8138
Verifier: Avoid unnecessary hasFnAttr (#138104)
When checking string attribute values are valid, it's not
necessary to check hasFnAttr prior to querying the value.
2025-05-01 13:08:39 +02:00
David Green
9b1051281e
[DAG] Use SDValue for PatFrag checks (#137519)
If the SDNode is used it can pick up the wrong results number, for
example looking at the known bits of the first result where it should be
looking at the second. The SDValue is already present as the
SelectCodeCommon checks move from parent to child, pass the SDValue
through to CheckNodePredicate as Op so that it can use it if necessary.
SDNode *N is still generated, keeping most PatFrags the same.

Fixes #137274
2025-05-01 08:58:59 +01:00
Alex MacLean
6efdcc1885
[NVPTX] Fixup EXT_LOAD lowering for i128 values (#138049)
Ensure that when custom lowering a vector load/store to a multi-output
load/store node we confirm that the memory value type matches the type
used by the node. Also add some asserts for basic sanity checking of
load size.

Fixes https://github.com/llvm/llvm-project/issues/138034
2025-04-30 20:51:55 -07:00
LLVM GN Syncbot
b564f5eaeb [gn build] Port 07deaf8464f2 2025-05-01 02:14:51 +00:00
Michael Spencer
07deaf8464
Reland: [llvm][clang] Allocate a new stack instead of spawning a new thread to get more stack space (#136046)
Reland https://github.com/llvm/llvm-project/pull/133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
2025-04-30 19:14:15 -07:00
Jason Eckhardt
7d05f67a73
[TableGen][CallingConv] Add CCAssignToRegTuple for synthetic registers. (#137826)
Currently CCAssignToReg takes a list<Register>. There are tuple-heavy
back-ends where we would like to reference any register-- whether those
are singletons or those defined by RegisterTuples. However, the latter
are synthesized during tuple expansion and are not visible outside of
the register info emitter.

The problem is that the parser will see tuple registers as undefined
variables before the calling convention emitter is ever reached. To
defer evaluation of the symbol, we introduce CCAssignToRegTuple which
takes list<string> instead. This allows us to defer the actual
register name lookup until the emitter runs-- where we also validate
that the register actually exists.

This is currently used in a downstream back-end which will be upstreamed
very soon. In the meantime, a unit test is provided to exercise the
feature.
2025-04-30 18:32:37 -05:00
Haowei
5dc3cd0ee4
[llvm-exegesis][AArch64] Adding missing PR_PAC_ macro defintions (#138040)
This is a follow up of 3beacfa022da2a9c94e012e25bed89e8e4867ac2, which
added the PR_PAC_APIAKEY macro to resolve the build failures on older Linux
distros. However, it missed a few other definitions. This patch fixes
this issue.
2025-04-30 16:00:43 -07:00
mssefat
71039bbc58
[AMDGPU] Fix register class constraints for si-fold-operands pass when folding immediate into copies (#131387)
Fixes https://github.com/llvm/llvm-project/issues/130020

This fixes an issue where the si-fold-operands pass would incorrectly
fold immediate values into COPY instructions targeting av_32 registers.

The pass now checks register class constraints before attempting to fold
the immediate.
2025-04-30 17:36:46 -05:00
Craig Topper
af45da1d32 [RISCV] Remove unused tablegen multiclass. NFC 2025-04-30 15:07:45 -07:00