58581 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
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
Alex MacLean
978df3b9f1
[NVPTX][test] Fixup to get ptxas passing for byval-const-global.ll (#138175) 2025-05-01 12:38:39 -07: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
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
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
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
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
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
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
Shubham Sandeep Rastogi
9b8c96a040
[InstrRef] Preserve debug instr num in aarch64-ldst-opt. (#136009)
The aarch64-ldst-opt pass tries to merge two load instructions
(LDR*) to a load pair instruction (LDP*).

When merging the instructions, there is a case where one of the 
loads would have to also be sign extended. In either case, 
(sign extend or not), the pass needs to preserve the debug-instr-number
from the original loads to the load pair instruction to make sure debug
info
isn't lost in the case where instruction referencing is being used.

For example:

We can have something like this:

```
debugValueSubstitutions:[]
$x1 = LDRXui $x0, 1, debug-instr-number 1
DBG_INSTR_REF !13, dbg-instr-ref(1, 0), debug-location !11
$x0 = LDRXui killed $x0, 0, debug-instr-number 2
DBG_INSTR_REF !14, dbg-instr-ref(2, 0), debug-location !11
```

This would be changed to:

```
debugValueSubstitutions: []
$x0, $x1 = LDPXi $x0, 0
DBG_INSTR_REF !12, dbg-instr-ref(1, 0), debug-location !14
DBG_INSTR_REF !13, dbg-instr-ref(2, 0), debug-location !14
```

In this case, we need to create a new debug instruction number
for the `LDP` instruction, we then need to add entries into the 
debugSubstitutions table to map the old instr-refs to the new ones.

After this patch, the result will be:
```
 debugValueSubstitutions:
 - { srcinst: 1, srcop: 0, dstinst: 3, dstop: 1, subreg: 0 }
 - { srcinst: 2, srcop: 0, dstinst: 3, dstop: 0, subreg: 0 }
 $x0, $x1 = LDPXi $x0, 0, debug-instr-number 3
 DBG_INSTR_REF !12, dbg-instr-ref(1, 0), debug-location !14
 DBG_INSTR_REF !12, dbg-instr-ref(2, 0), debug-location !14
```

However, this is not all, we also can have a case where there is a
sign-extend involved, let's look at the case:

```
debugValueSubstitutions:[]
$w1 = LDRWui $x0, 1, debug-instr-number 1
DBG_INSTR_REF !7, dbg-instr-ref(1, 0), debug-location !9
$x0 = LDRSWui $x0, 0, debug-instr-number 2
DBG_INSTR_REF !8, dbg-instr-ref(2, 0), debug-location !9
```

This will become:

```
debugValueSubstitutions:[]
$w0, $w1 = LDPWi $x0, 0
$w0 = KILL $w0, implicit-def $x0
$x0 = SBFMXri $x0, 0, 31
DBG_INSTR_REF !7, dbg-instr-ref(1, 0), debug-location !9
DBG_INSTR_REF !8, dbg-instr-ref(2, 0), debug-location !9
```
$x0 is where the final value is stored, so the sign extend (SBFMXri)
instruction contains the final value we care about we give it a new
debug-instr-number 3. Whereas, $w1 contains the final value that we care
about, therefore the LDP instruction is also given a new
debug-instr-number 4. We have to add these subsitutions to the
debugValueSubstitutions table. However, we also have to ensure that the
OpIndex that pointed to debug-instr-number 1 gets updated to 1, because
$w1 is the second operand of the LDP instruction.

The result after the patch looks like:

```
debugValueSubstitutions:
- { srcinst: 1, srcop: 0, dstinst: 4, dstop: 1, subreg: 0 }
- { srcinst: 2, srcop: 0, dstinst: 3, dstop: 0, subreg: 0 }
$w0, $w1 = LDPWi $x0, 0, debug-instr-number 4
$w0 = KILL $w0, implicit-def $x0
$x0 = SBFMXri $x0, 0, 31, debug-instr-number 3
DBG_INSTR_REF !7, dbg-instr-ref(1, 0), debug-location !9
DBG_INSTR_REF !8, dbg-instr-ref(2, 0), debug-location !9
```


This patch addresses that problem.
2025-04-30 14:17:22 -07:00
Farzon Lotfi
02e316cf8c
[DirectX] legalize memset (#136244)
fixes #136243

This change converts memset into a series of geps and stores It is
intentionally limited to memsets of fixed size It also converts the byte
stores to type stores.
DXIL does not support i8 plus this reduces the total number of gep and
store instructions.
This change also moves DXILFinalizeLinkage to run after Legalization to
clean up any dead intrinsic definitions.
2025-04-30 17:09:28 -04:00
Jonathan Thackray
60c9f3fd89
[AArch64][llvm] Codegen for 16/32/64-bit floating-point atomicrmw fminimum/faximum (#137703)
Codegen for AArch64 16/32/64-bit floating-point atomic read-modify-write
operations (`atomicrmw {fmaximum,fminimum}`) using LD{B}FMAX and
LD{B}FMIN atomic instructions.
2025-04-30 22:08:44 +01:00
Jonathan Thackray
4ac4ad410c
[AArch64][llvm] Pre-commit tests for #137703 (NFC) (#137702)
Add pre-commit tests for lowering atomicrmw `fminimum`/`fmaximum` to
AArch64 assembler, in a subsequent change.
2025-04-30 22:06:56 +01:00
Jonathan Thackray
6e49f73825
Reland [llvm] Add support for llvm IR atomicrmw fminimum/fmaximum instructions (#137701)
This patch adds support for LLVM IR atomicrmw `fmaximum` and `fminimum`
instructions.

These mirror the `llvm.maximum.*` and `llvm.minimum.*` instructions, but
are atomic and use IEEE754 2019 handling for NaNs, which is different to
`fmax` and `fmin`. See:
     https://llvm.org/docs/LangRef.html#llvm-minimum-intrinsic
for more details.

Future changes will allow this LLVM IR to be lowered to specialised
assembler instructions on suitable targets, such as AArch64.
2025-04-30 22:06:37 +01:00
Prabhu Rajasekaran
1531dfcb3a
[llvm] Linker flags for UEFI (#137878)
Use appropriate linker flag format to match PE spec for UEFI.
2025-04-30 12:14:58 -07:00
Alexander Richardson
ee13638362
[AMDGPU] Remove explicit datalayout from tests where not needed
Since e39f6c1844fab59c638d8059a6cf139adb42279a opt will infer the
correct datalayout when given a triple. Avoid explicitly specifying it
in tests that depend on the AMDGPU target being present to avoid the
string becoming out of sync with the TargetInfo value.
Only tests with REQUIRES: amdgpu-registered-target or a local lit.cfg
were updated to ensure that tests for non-target-specific passes that
happen to use the AMDGPU layout still pass when building with a limited
set of targets.

Reviewed By: shiltian, arsenm

Pull Request: https://github.com/llvm/llvm-project/pull/137921
2025-04-30 10:58:17 -07:00
zhijian lin
41647412c6
[PowerPC] Fix an LowerADDSUBO_CARRY error when converting carry bit for usubo_carry (#137809)
In PowerPC, if a borrow occurs during a subtraction, the carry bit is
zero (unset). The carry bit is set if no borrow occurs.

For ISD::USUBO_CARRY, the nodes produce two results: the normal result
of the addition or subtraction, and a boolean value that is 1 if and
only if there is an outgoing carry or borrow.

Therefore, we need to convert a 1 (which indicates a borrow in
ISD::USUBO_CARRY) to 0 to match PowerPC's definition of borrow.
Similarly, we need to convert a 0 (no borrow in ISD::USUBO_CARRY) to 1
for PowerPC.

To perform this conversion, we use XOR 1 instead of XOR
DAG.getAllOnesConstant(DL, CarryOp.getValueType()).

`
2025-04-30 10:39:09 -04:00
mssefat
7495f92f08
[AMDGPU] Fix undefined scc register in successor block of SI_KILL terminators (#134718)
Fix issue 131298 where an undefined $scc register causes verifier errors
when using SI_KILL_F32_COND_IMM_TERMINATOR instructions. The problem
occurs because the $scc register defined in a comparison before the kill
terminator is used in successor blocks, but was not properly marked as live-in.

This patch:
- Adds code to check if SCC is used in the successor block
- Adds SCC as a live-in to successor blocks
- Handles both explicit and implicit uses of SCC

With this patch the machine verifier no longer reports undefined $scc
errors in following kill terminator instruction.

Fixes #131298

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-04-30 09:02:45 -05:00
Steven Perron
a5fef2aff8
[SPIRV] Fix test with VK1.3 validation (#137633)
An update to the spirv validator is now correctly rejecting vulkan
shaders with the linkage capability. We have a couple tests that need
updating to remove the capability.

Fixes https://github.com/llvm/llvm-project/issues/136344
2025-04-30 09:47:57 -04:00
Nikita Popov
6feb4a8ef4
[IR] Don't allow values of opaque type (#137625)
Consider opaque types as non-first-class types, i.e. do not allow SSA
values to have opaque type.
2025-04-30 15:01:00 +02:00
Akshat Oke
e91cbd4f29
[CodeGen][NPM] Port VirtRegRewriter to NPM (#130564) 2025-04-30 14:10:46 +05:30
YunQiang Su
db859db74d Revert "CodeGen: Add ISD::AssertNoFPClass (#135946)"
This reverts commit f0c61d2242bbc7576ca5e4137a5ea8f63e4859a9.
2025-04-30 16:16:26 +08:00
Vikram Hegde
53a8b89003
[CodeGen][NewPM] Port "ShrinkWrap" pass to NPM (#129880) 2025-04-30 13:11:17 +05:30
Nikita Popov
38cb7d5e75
[IR] Don't allow label arguments (#137799)
We currently accept label arguments to inline asm calls. This support
predates both blockaddresses and callbr and is only covered by one X86
test. Remove it in favor of callbr (or at least blockaddress, though
that cannot guarantee correct codegen, just like using block labels
directly can't).

I didn't bother implementing bitcode upgrade support for this, but I can
add it if desired.
2025-04-30 09:11:36 +02:00
Farzon Lotfi
d3d35adcd3
[DirectX] Legalize i8 allocas (#137399)
fixes #137202

investingating i8 allocas I came to find some missing instructions from
out i8 legalization around load, store, and select.
Added those three.

To do i8 allocas right though we needed to walk the uses and find the
casts.

After finding the casts I chose to pick the smallest cast as the cast to
transform to. That would then let me preserve the larger casts that come
later
2025-04-29 16:07:44 -04:00
Peter Collingbourne
c88b537771
Target: Stop assigning RELRO sections to .ldata.rel.ro.
Linkers do not currently support PT_GNU_RELRO for SHF_X86_64_LARGE
sections; that would require the linker to emit more than one
PT_GNU_RELRO because large sections are discontiguous by design,
and most ELF dynamic loaders do not support that (bionic appears to
support it but glibc/musl/FreeBSD/NetBSD/OpenBSD appear not to). With
current linkers these sections will end up in .ldata which results
in silently disabling RELRO. Therefore, disable SHF_X86_64_LARGE for
RELRO sections. If this ever gets supported by downstream components
in the future we could add an opt-in flag for moving these sections
to .ldata.rel.ro which would trigger the creation of a second
PT_GNU_RELRO.

Reviewers: MaskRay, aeubanks

Reviewed By: aeubanks

Pull Request: https://github.com/llvm/llvm-project/pull/137742
2025-04-29 12:40:43 -07:00
Sergei Barannikov
becd418626
[CGP] Despeculate ctlz/cttz with "illegal" integer types (#137197)
The code below the removed check looks generic enough to support
arbitrary integer widths. This change helps 32-bit targets avoid
expensive expansion/libcalls in the case of zero input.

Pull Request: https://github.com/llvm/llvm-project/pull/137197
2025-04-29 22:33:40 +03:00
Deric C.
e33b7a1d63
[DirectX] Implement Shader Flag Analysis for UAVsAtEveryStage (#137085)
Fixes #112272

In addition to the implementation of the UAVsAtEveryStage shader flag
analysis, several unrelated tests have had the `dx.valver` module
metadata defined to avoid setting the UAVsAtEveryStage shader flag in
them.
Example:
```
!dx.valver = !{!0}
!0 = !{i32 1, i32 8}
```

---------

Co-authored-by: Justin Bogner <mail@justinbogner.com>
2025-04-29 11:56:21 -07:00
Deric C.
ad66e5495d
[DirectX] Revise descriptions of DXIL module flags (#133543)
This PR revises the descriptions of DXIL module flags.

Descriptions such as `D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION` are
referring to Global Flags in DXBC.
DXBC is not a supported backend target, so references to DXBC should not
be present.

There is also confusion with regards to the description of the
`LowPrecisionPresent` DXIL module flag, which currently reads
`D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION` and implies the use of
minimum-precision to handle 16-bit types.
However this is not true, because both the flags `LowPrecisionPresent`
and `UseNativeLowPrecision` can simultaneously be set in the same DXIL
module, and minimum precision mode is mutually exclusive with native low
precision.
This PR revises the description of the `LowPrecisionPresent` flag to
accurately describe what it represents.
2025-04-29 09:08:12 -07:00
Craig Topper
900505900e
[RISCV] Check the VT for R and cR inline asm constraints is 2*xlen. (#137749)
Fixes #137726.
2025-04-29 08:12:32 -07:00
Feng Zou
f02c93d707
[X86] Remove LLD command in LIT test (#137794)
The test introduced in #136660, may be failed as ld.lld command not
found.
2025-04-29 21:27:36 +08:00
Rohit Aggarwal
2466100128
[X86] Add new #134979 test cases for gather scalar (#137416)
We are adding new test cases to see the transformation impact due to #134979.

These are similar to previous commit #688c3ffb057a87b86c6c1e77040418adf511efbb.

Handling struct with two member and different vector factor.

---------

Co-authored-by: Rohit Aggarwal <Rohit.Aggarwal@amd.com>
2025-04-29 13:52:43 +01:00
Tobias Stadler
0b5daeb2e5
[GlobalISel] Fix miscompile when narrowing vector loads/stores to non-byte-sized types (#136739)
LegalizerHelper::reduceLoadStoreWidth does not work for non-byte-sized
types, because this would require (un)packing of bits across byte
boundaries.

Precommit tests: #134904
2025-04-29 12:36:34 +01:00
Feng Zou
bd6addc032
[X86][APX] Suppress EGPR/NDD instructions for relocations (#136660)
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
2025-04-29 19:12:59 +08:00
Victor Lomuller
082598a64d
[SPIRV] Add intrinsic for OpGenericCastToPtrExplicit (#137626)
The patch adds an intrinsic to encode OpGenericCastToPtrExplicit and the
associated lowering logic.
2025-04-29 11:58:25 +02:00
Simon Pilgrim
8961f3ee75
[X86] shouldReduceLoadWidth - don't split loads if we can freely reuse full width legal binop (#129695)
Currently shouldReduceLoadWidth is very relaxed about when loads can be
split to avoid extractions from the original full width load - resulting
in many cases where the number of memory operations notably increases,
replacing the cost of a extract_subvector for additional loads.

This patch adjusts the 256/512-bit vector load splitting metric to
detect cases where ANY use of the full width load is be used directly -
in which case we will now reuse that load for smaller types, unless we'd
need to extract an upper subvector / integer element - i.e. we now
correctly treat (extract_subvector cst, 0) as free.

We retain the existing logic of never splitting loads if all uses are
extract+stores but we improve this by peeking through bitcasts while
looking for extract_subvector/store chains.

This required a number of fixes - shouldReduceLoadWidth now needs to
peek through bitcasts UP the use-chain to find final users (limited to
hasOneUse cases to reduce complexity). It also exposed an issue in
isTargetCanonicalConstantNode which assumed that a load of vector
constant data would always extract, which is no longer the case.
2025-04-29 10:35:15 +01:00
Vikram Hegde
86d8e8d9a6
[CodeGen][NewPM] Port "PrologEpilogInserter" to NPM (#130550) 2025-04-29 13:13:45 +05:30
Sam Elliott
4e175b8896
[RISCV] Fix Defs/Uses for SiFive CLIC Support (#137724)
The expensive checks bots found issues with #132481, due to not setting
defs/uses correctly. In 31bd7a507152 I added verify flags, so that the
failure is reproduced without requiring expensive checks, and xfailed
the test.

This change:
- Ensures that registers are correctly marked as defs/uses.
- Removes the xfail.
- Leaves the tests with `-verify-machineinstrs` which should have been
present originally.
2025-04-28 19:35:11 -07:00
Maryam Moghadas
82a1d5078d
[PowerPC] Add dense math half-precision floating-point outer-product accumulate to DMR instructions (#133272)
This patch adds the following Dense Math Facility 16-bit half-precision
floating-point calculation instructions: dmxvf16gerx2, dmxvf16gerx2pp,
dmxvf16gerx2pn, dmxvf16gerx2np, dmxvf16gerx2nn, pmdmxvf16gerx2,
pmdmxvf16gerx2pp, pmdmxvf16gerx2pn, pmdmxvf16gerx2np, pmdmxvf16gerx2nn,
along with their corresponding intrinsics and tests.
2025-04-28 16:03:10 -04:00
Sam Elliott
31bd7a5071 [RISCV] XFAIL SiFive Interrupt Test 2025-04-28 13:00:49 -07:00
Joshua Batista
c8b3d79961
[DXIL] Remove incompatible metadata types when preparing DXIL. (#136386)
This PR introduces a Metadata Node Kind allowlist. The purpose is to
prevent newer Metadata Node Kinds to be used and inserted into the
outputted DXIL module. Only the metadata kinds that are accepted in the
DXIL Validator are on the allowlist. The Github DXC validator doesn't
support these newer Metadata Node Kinds, so we need to filter them out.

We introduce this restrictive allowlist into LLVM and strip all metadata
that isn't found in the list.

The accompanying test would add the `llvm.loop.mustprogress` metadata
node kind, but thanks to the allowlist, filters it out, and so the
whitelist is proven to work.
The test also has two separate metadata kinds that are on the allowlist,
and remain after the DXIL Prepare pass.
2025-04-28 12:43:38 -07:00
Sirish Pande
abec9ff47d
[AMDGPU] Correctly merge noalias scopes during lowering of LDS data. (#131664)
Currently, if there is already noalias metadata present on loads and
stores, lower module lds pass is generating a more conservative aliasing
set. This results in inhibiting scheduling intrinsics that would have
otherwise generated a better pipelined instruction.

The fix is not to always intersect already existing noalias metadata
with noalias created for lowering of LDS. But to intersect only if
noalias scopes are from the same domain, otherwise concatenate exising
noalias sets with LDS noalias.

There a few patches that have come for scopedAA in the past. Following
three should be enough background information.
https://reviews.llvm.org/D91576
https://reviews.llvm.org/D108315
https://reviews.llvm.org/D110049

Essentially, after a pass that might change aliasing info, one should
check if that pass results in change number of MayAlias or ModRef using
the following:
`opt -S -aa-pipeline=basic-aa,scoped-noalias-aa -passes=aa-eval
-evaluate-aa-metadata -print-all-alias-modref-info -disable-output`
2025-04-28 14:02:18 -05:00
weiguozhi
b25b51eb63
[InlineSpiller] Check rematerialization before folding operand (#134015)
Current implementation tries to fold the operand before
rematerialization because it can reduce one register usage. But if there
is a physical register available we can still rematerialize it without
causing high register pressure.

This patch do this check to find the better choice. Then we can produce

    xorps %xmm1, %xmm1
    ucomiss %xmm1, %xmm0

instead of 

    ucomiss LCPI0_1(%rip), %xmm0
2025-04-28 09:52:03 -07:00
Victor Lomuller
76d83e6250
[SPIRV] Correctly map OpGenericCastToPtrExplicit builtins (#137189)
The __spirv_GenericCastToPtrExplicit_To* builtins and its equivalent
OpenCL builtins (to_global, to_local and to_private) were mapped to
OpGenericCastToPtr instead of OpGenericCastToPtrExplicit.

The patch now uses OpGenericCastToPtrExplicit for these builtins.
2025-04-28 18:05:24 +02:00
Victor Lomuller
0cd20537c6
[SPIRV] Stop unconditionally emitting SPV_INTEL_arbitrary_precision_integers when allowed (#137167)
When the SPV_INTEL_arbitrary_precision_integers extension is allowed to
be used, the backend will unconditionnally add it to the module used
extensions.

The patch prevent SPV_INTEL_arbitrary_precision_integers from being
declared if unneeded.
2025-04-28 18:05:06 +02:00