[llvm] [AMDGPU] Preserve WWM ownership of allocated AGPRs (PR #223278)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 14:20:37 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Yaxun (Sam) Liu (yxsamliu)
<details>
<summary>Changes</summary>
Live-range splitting can widen WWM VGPR classes to classes that also
allow AGPRs. A split fragment may then escape the temporary WWM VGPR
pool and be reused by later per-lane allocation.
Record the physical register assigned to each WWM copy destination as
WWM-owned. Preserve the register at function entry and exit, including
AGPRs, and keep its spill slot associated with the register when PEI
compacts WWM VGPRs.
---
Patch is 37.72 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/223278.diff
13 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/SIFrameLowering.cpp (+15-16)
- (modified) llvm/lib/Target/AMDGPU/SILowerWWMCopies.cpp (+15-12)
- (modified) llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp (+19-4)
- (modified) llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h (+9-9)
- (modified) llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp (+2-2)
- (modified) llvm/lib/Target/AMDGPU/SIRegisterInfo.h (+1-1)
- (modified) llvm/test/CodeGen/AMDGPU/bug-undef-spilled-agpr.mir (+88-73)
- (modified) llvm/test/CodeGen/AMDGPU/preserve-wwm-copy-dst-reg.ll (+6-5)
- (modified) llvm/test/CodeGen/AMDGPU/si-lower-wwm-copies.mir (+33-2)
- (modified) llvm/test/CodeGen/AMDGPU/whole-wave-register-copy.ll (+7-9)
- (added) llvm/test/CodeGen/AMDGPU/wwm-physical-copy-pei.mir (+66)
- (added) llvm/test/CodeGen/AMDGPU/wwm-regalloc-reserve-split-agpr.mir (+53)
- (added) llvm/test/CodeGen/AMDGPU/wwm-spill-undef-loop.mir (+47)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
index 92fb77b1e6436..494dd1a580d76 100644
--- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -1204,9 +1204,9 @@ void SIFrameLowering::emitCSRSpillStores(
MachineRegisterInfo &MRI = MF.getRegInfo();
const AMDGPU::LaneMaskConstants &LMC = AMDGPU::LaneMaskConstants::get(ST);
- // Spill Whole-Wave Mode VGPRs. Save only the inactive lanes of the scratch
- // registers. However, save all lanes of callee-saved VGPRs. Due to this, we
- // might end up flipping the EXEC bits twice.
+ // Spill Whole-Wave Mode vector registers. Save only the inactive lanes of
+ // the scratch registers. However, save all lanes of callee-saved registers.
+ // Due to this, we might end up flipping the EXEC bits twice.
Register ScratchExecCopy;
SmallVector<std::pair<Register, int>, 2> WWMCalleeSavedRegs, WWMScratchRegs;
FuncInfo->splitWWMSpillRegisters(MF, WWMCalleeSavedRegs, WWMScratchRegs);
@@ -1218,15 +1218,15 @@ void SIFrameLowering::emitCSRSpillStores(
auto StoreWWMRegisters =
[&](SmallVectorImpl<std::pair<Register, int>> &WWMRegs) {
for (const auto &Reg : WWMRegs) {
- Register VGPR = Reg.first;
+ Register WWMReg = Reg.first;
int FI = Reg.second;
buildPrologSpill(ST, TRI, *FuncInfo, LiveUnits, MF, MBB, MBBI, DL,
- VGPR, FI, FrameReg);
+ WWMReg, FI, FrameReg);
if (NeedsFrameMoves) {
- // We spill the entire VGPR, so we can get away with just cfi_offset
+ // We spill the entire register, so a cfi_offset is sufficient.
buildCFI(MBB, MBBI, DL,
MCCFIInstruction::createOffset(
- nullptr, MCRI->getDwarfRegNum(VGPR, false),
+ nullptr, MCRI->getDwarfRegNum(WWMReg, false),
MFI.getObjectOffset(FI) * ST.getWavefrontSize()));
}
}
@@ -1339,19 +1339,19 @@ void SIFrameLowering::emitCSRSpillRestores(
SB.restore();
}
- // Restore Whole-Wave Mode VGPRs. Restore only the inactive lanes of the
- // scratch registers. However, restore all lanes of callee-saved VGPRs. Due to
- // this, we might end up flipping the EXEC bits twice.
+ // Restore Whole-Wave Mode vector registers. Restore only the inactive lanes
+ // of the scratch registers. However, restore all lanes of callee-saved
+ // registers. Due to this, we might end up flipping the EXEC bits twice.
Register ScratchExecCopy;
SmallVector<std::pair<Register, int>, 2> WWMCalleeSavedRegs, WWMScratchRegs;
FuncInfo->splitWWMSpillRegisters(MF, WWMCalleeSavedRegs, WWMScratchRegs);
auto RestoreWWMRegisters =
[&](SmallVectorImpl<std::pair<Register, int>> &WWMRegs) {
for (const auto &Reg : WWMRegs) {
- Register VGPR = Reg.first;
+ Register WWMReg = Reg.first;
int FI = Reg.second;
buildEpilogRestore(ST, TRI, *FuncInfo, LiveUnits, MF, MBB, MBBI, DL,
- VGPR, FI, FrameReg);
+ WWMReg, FI, FrameReg);
}
};
@@ -1966,11 +1966,10 @@ void SIFrameLowering::determineCalleeSaves(MachineFunction &MF,
SmallVector<Register> SortedWWMVGPRs;
for (Register Reg : MFI->getWWMReservedRegs()) {
- // The shift-back is needed only for the VGPRs used for SGPR spills and they
- // are of 32-bit size. SIPreAllocateWWMRegs pass can add tuples into WWM
- // reserved registers.
+ // The shift-back supports only 32-bit VGPRs. WWM reserved registers may
+ // also contain AGPRs or tuples.
const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(Reg);
- if (TRI->getRegSizeInBits(*RC) != 32)
+ if (!TRI->isVGPRClass(RC) || TRI->getRegSizeInBits(*RC) != 32)
continue;
SortedWWMVGPRs.push_back(Reg);
}
diff --git a/llvm/lib/Target/AMDGPU/SILowerWWMCopies.cpp b/llvm/lib/Target/AMDGPU/SILowerWWMCopies.cpp
index ac8f5b990c5fa..6be435bc3be06 100644
--- a/llvm/lib/Target/AMDGPU/SILowerWWMCopies.cpp
+++ b/llvm/lib/Target/AMDGPU/SILowerWWMCopies.cpp
@@ -38,7 +38,7 @@ class SILowerWWMCopies {
private:
bool isSCCLiveAtMI(const MachineInstr &MI);
- void addToWWMSpills(MachineFunction &MF, Register Reg);
+ void reserveWWMRegister(MachineFunction &MF, Register Reg);
LiveIntervals *LIS;
SlotIndexes *Indexes;
@@ -92,17 +92,20 @@ bool SILowerWWMCopies::isSCCLiveAtMI(const MachineInstr &MI) {
return LR.liveAt(Idx);
}
-// If \p Reg is assigned with a physical VGPR, add the latter into wwm-spills
-// for preserving its entire lanes at function prolog/epilog.
-void SILowerWWMCopies::addToWWMSpills(MachineFunction &MF, Register Reg) {
- if (Reg.isPhysical())
- return;
-
- // FIXME: VRM may be null here.
- MCRegister PhysReg = VRM->getPhys(Reg);
- assert(PhysReg && "should have allocated a physical register");
+// Record the physical register assigned to a WWM copy destination. It remains
+// owned by the WWM allocation after the temporary allocation mask is cleared.
+void SILowerWWMCopies::reserveWWMRegister(MachineFunction &MF, Register Reg) {
+ Register PhysReg = Reg;
+ if (Reg.isVirtual()) {
+ assert(VRM && "expected VirtRegMap after WWM register allocation");
+ PhysReg = VRM->getPhys(Reg);
+ assert(PhysReg && "should have allocated a physical register");
+ }
- MFI->allocateWWMSpill(MF, PhysReg);
+ MFI->reserveWWMRegister(PhysReg);
+ const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(PhysReg);
+ MFI->allocateWWMSpill(MF, PhysReg, TRI->getSpillSize(*RC),
+ TRI->getSpillAlign(*RC));
}
bool SILowerWWMCopiesLegacy::runOnMachineFunction(MachineFunction &MF) {
@@ -159,7 +162,7 @@ bool SILowerWWMCopies::run(MachineFunction &MF) {
TII->insertScratchExecCopy(MF, MBB, InsertPt, DL, RegForExecCopy,
isSCCLiveAtMI(MI), Indexes);
TII->restoreExec(MF, MBB, ++InsertPt, DL, RegForExecCopy, Indexes);
- addToWWMSpills(MF, MI.getOperand(0).getReg());
+ reserveWWMRegister(MF, MI.getOperand(0).getReg());
LLVM_DEBUG(dbgs() << "WWM copy manipulation for " << MI);
// Lower WWM_COPY back to COPY
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
index d1df50d26a832..fb03376d70de4 100644
--- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -295,10 +295,10 @@ SmallVectorImpl<MCRegister> *SIMachineFunctionInfo::addPreloadedKernArg(
return &Regs;
}
-void SIMachineFunctionInfo::allocateWWMSpill(MachineFunction &MF, Register VGPR,
+void SIMachineFunctionInfo::allocateWWMSpill(MachineFunction &MF, Register Reg,
uint64_t Size, Align Alignment) {
// Skip if it is an entry function or the register is already added.
- if (isEntryFunction() || WWMSpills.count(VGPR))
+ if (isEntryFunction() || WWMSpills.count(Reg))
return;
// Skip if this is a function with the amdgpu_cs_chain or
@@ -311,12 +311,12 @@ void SIMachineFunctionInfo::allocateWWMSpill(MachineFunction &MF, Register VGPR,
// llvm.amdgcn.init.whole.wave (since in that case there are no inactive lanes
// when entering the function).
if (isChainFunction() &&
- (SIRegisterInfo::isChainScratchRegister(VGPR) ||
+ (SIRegisterInfo::isChainScratchRegister(Reg) ||
!MF.getFrameInfo().hasTailCall() || hasInitWholeWave()))
return;
WWMSpills.insert(std::make_pair(
- VGPR, MF.getFrameInfo().CreateSpillStackObject(Size, Alignment)));
+ Reg, MF.getFrameInfo().CreateSpillStackObject(Size, Alignment)));
}
// Separate out the callee-saved and scratch registers.
@@ -361,6 +361,21 @@ void SIMachineFunctionInfo::shiftWwmVGPRsToLowestRange(
WWMVGPRs[I] = NewReg;
WWMReservedRegs.remove(Reg);
WWMReservedRegs.insert(NewReg);
+
+ // Keep any spill slot allocated before PEI associated with the register
+ // after compaction. Rebuild the MapVector to preserve spill/restore order.
+ if (WWMSpills.contains(Reg)) {
+ assert(!WWMSpills.contains(NewReg) &&
+ "replacement WWM register already has a spill slot");
+ auto Spills = WWMSpills.takeVector();
+ auto Spill = llvm::find_if(
+ Spills, [Reg](const auto &Entry) { return Entry.first == Reg; });
+ assert(Spill != Spills.end() && "missing WWM spill entry");
+ Spill->first = NewReg;
+ for (auto &Entry : Spills)
+ WWMSpills.insert(std::move(Entry));
+ }
+
MRI.reserveReg(NewReg, TRI);
// Replace the register in SpillPhysVGPRs. This is needed to look for free
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
index 0207c728ea9b8..7188812c0d637 100644
--- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
@@ -573,10 +573,10 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunctionInfo,
using WWMSpillsMap = MapVector<Register, int>;
// To track the registers used in instructions that can potentially modify the
// inactive lanes. The WWM instructions and the writelane instructions for
- // spilling SGPRs to VGPRs fall under such category of operations. The VGPRs
- // modified by them should be spilled/restored at function prolog/epilog to
- // avoid any undesired outcome. Each entry in this map holds a pair of values,
- // the VGPR and its stack slot index.
+ // spilling SGPRs to VGPRs fall under such category of operations. The vector
+ // registers modified by them should be spilled/restored at function
+ // prolog/epilog to avoid any undesired outcome. Each entry in this map holds
+ // a pair of values, the register and its stack slot index.
WWMSpillsMap WWMSpills;
// Before allocation, the VGPR registers are partitioned into two distinct
@@ -585,10 +585,10 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunctionInfo,
BitVector PerLaneVGPRMask;
using ReservedRegSet = SmallSetVector<Register, 8>;
- // To track the VGPRs reserved for WWM instructions. They get stack slots
- // later during PrologEpilogInserter and get added into the superset WWMSpills
- // for actual spilling. A separate set makes the register reserved part and
- // the serialization easier.
+ // To track the vector registers reserved for WWM instructions. WWMSpills
+ // contains the subset that needs prolog/epilog preservation; its spill slots
+ // may be allocated when a register becomes physical or later during PEI. A
+ // separate set makes the register reserved part and serialization easier.
ReservedRegSet WWMReservedRegs;
bool IsWholeWaveFunction = false;
@@ -810,7 +810,7 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunctionInfo,
bool hasVRegFlags() { return VRegFlags.size(); }
- void allocateWWMSpill(MachineFunction &MF, Register VGPR, uint64_t Size = 4,
+ void allocateWWMSpill(MachineFunction &MF, Register Reg, uint64_t Size = 4,
Align Alignment = Align(4));
void splitWWMSpillRegisters(
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
index f570aa4e2f6fb..ac9761a50160f 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -468,8 +468,8 @@ const uint32_t *SIRegisterInfo::getNoPreservedMask() const {
return CSR_AMDGPU_NoRegs_RegMask;
}
-bool SIRegisterInfo::isChainScratchRegister(Register VGPR) {
- return VGPR >= AMDGPU::VGPR0 && VGPR < AMDGPU::VGPR8;
+bool SIRegisterInfo::isChainScratchRegister(Register Reg) {
+ return Reg >= AMDGPU::VGPR0 && Reg < AMDGPU::VGPR8;
}
const TargetRegisterClass *
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
index 66909861271e2..51c42ea17ea24 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
@@ -105,7 +105,7 @@ class SIRegisterInfo final : public AMDGPUGenRegisterInfo {
// Functions with the amdgpu_cs_chain or amdgpu_cs_chain_preserve calling
// conventions are free to use certain VGPRs without saving and restoring any
// lanes (not even inactive ones).
- static bool isChainScratchRegister(Register VGPR);
+ static bool isChainScratchRegister(Register Reg);
unsigned getCSRFirstUseCost(const MachineFunction &) const override {
// The cost of 27 balances multiple factors that influence CSR cost:
diff --git a/llvm/test/CodeGen/AMDGPU/bug-undef-spilled-agpr.mir b/llvm/test/CodeGen/AMDGPU/bug-undef-spilled-agpr.mir
index 5c564decd1e7d..d02e41b63841b 100644
--- a/llvm/test/CodeGen/AMDGPU/bug-undef-spilled-agpr.mir
+++ b/llvm/test/CodeGen/AMDGPU/bug-undef-spilled-agpr.mir
@@ -1,103 +1,118 @@
-# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
-# RUN: llc -mtriple=amdgpu9.08-amd-amdhsa -mcpu=gfx908 -run-pass=si-lower-sgpr-spills,greedy,si-lower-wwm-copies,virtregrewriter,prolog-epilog -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6
+# RUN: llc -mtriple=amdgpu9.08-amd-amdhsa -run-pass=prolog-epilog -verify-machineinstrs -o - %s | FileCheck %s
+# Keep the allocated AGPR case explicit. The AGPR must be live through the loop
+# and preserved across the function.
---
-name: widget
+name: widget
tracksRegLiveness: true
frameInfo:
- adjustsStack: true
-stack:
- - { id: 0, type: spill-slot, size: 4, alignment: 4, stack-id: sgpr-spill }
- - { id: 1, type: spill-slot, size: 4, alignment: 4, stack-id: sgpr-spill }
+ adjustsStack: true
machineFunctionInfo:
hasSpilledSGPRs: true
- scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
+ scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
stackPtrOffsetReg: '$sgpr32'
-body: |
- ; GCN-LABEL: name: widget
- ; GCN: bb.0:
- ; GCN-NEXT: successors: %bb.1(0x80000000)
- ; GCN-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $sgpr15, $agpr0
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: frame-setup CFI_INSTRUCTION llvm_def_aspace_cfa $sgpr32, 0, 6
- ; GCN-NEXT: frame-setup CFI_INSTRUCTION llvm_register_pair $pc_reg, $sgpr30, 32, $sgpr31, 32
- ; GCN-NEXT: frame-setup CFI_INSTRUCTION undefined $agpr0
- ; GCN-NEXT: frame-setup CFI_INSTRUCTION undefined $sgpr14
- ; GCN-NEXT: $sgpr4_sgpr5 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
- ; GCN-NEXT: $vgpr63 = V_ACCVGPR_READ_B32_e64 $agpr0, implicit $exec
- ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr63, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: ("amdgpu-thread-private" store (s32) into %stack.2, addrspace 5)
- ; GCN-NEXT: frame-setup CFI_INSTRUCTION offset $agpr0, 0
- ; GCN-NEXT: $exec = S_MOV_B64 -1
- ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr62, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 4, 0, 0, implicit $exec :: ("amdgpu-thread-private" store (s32) into %stack.3, addrspace 5)
- ; GCN-NEXT: frame-setup CFI_INSTRUCTION offset $vgpr62, 256
- ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5
- ; GCN-NEXT: renamable $vgpr62 = IMPLICIT_DEF
- ; GCN-NEXT: $vgpr62 = SI_SPILL_S32_TO_VGPR $sgpr15, 0, killed $vgpr62
- ; GCN-NEXT: $noreg = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
- ; GCN-NEXT: renamable $agpr0 = lr-split COPY killed renamable $vgpr62
- ; GCN-NEXT: $exec = S_MOV_B64 killed $noreg
- ; GCN-NEXT: renamable $vgpr62 = IMPLICIT_DEF
- ; GCN-NEXT: dead renamable $vgpr62 = V_AND_B32_e32 1, killed $vgpr62, implicit $exec
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: bb.1:
- ; GCN-NEXT: successors: %bb.3(0x40000000), %bb.2(0x40000000)
- ; GCN-NEXT: liveins: $agpr0
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
- ; GCN-NEXT: S_BRANCH %bb.3
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: bb.2:
- ; GCN-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
- ; GCN-NEXT: liveins: $agpr0, $sgpr86, $sgpr87, $sgpr66_sgpr67, $sgpr68_sgpr69, $sgpr70_sgpr71, $sgpr80_sgpr81, $sgpr82_sgpr83, $sgpr84_sgpr85, $sgpr96_sgpr97, $sgpr98_sgpr99
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: S_CBRANCH_EXECNZ %bb.1, implicit $exec
- ; GCN-NEXT: S_BRANCH %bb.4
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: bb.3:
- ; GCN-NEXT: successors: %bb.2(0x80000000)
- ; GCN-NEXT: liveins: $agpr0
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: $noreg = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
- ; GCN-NEXT: renamable $vgpr62 = lr-split COPY renamable $agpr0
- ; GCN-NEXT: $exec = S_MOV_B64 killed $noreg
- ; GCN-NEXT: $sgpr14 = SI_RESTORE_S32_FROM_VGPR killed $vgpr62, 1
- ; GCN-NEXT: S_BRANCH %bb.2
- ; GCN-NEXT: {{ $}}
- ; GCN-NEXT: bb.4:
- ; GCN-NEXT: $sgpr4_sgpr5 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
- ; GCN-NEXT: $vgpr63 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: ("amdgpu-thread-private" load (s32) from %stack.2, addrspace 5)
- ; GCN-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr63, implicit $exec
- ; GCN-NEXT: $exec = S_MOV_B64 -1
- ; GCN-NEXT: $vgpr62 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 4, 0, 0, implicit $exec :: ("amdgpu-thread-private" load (s32) from %stack.3, addrspace 5)
- ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5
- ; GCN-NEXT: SI_RETURN
+ vgprForAGPRCopy: '$vgpr63'
+ sgprForEXECCopy: '$sgpr4_sgpr5'
+ wwmReservedRegs: [ '$agpr0', '$vgpr62' ]
+body: |
+ ; CHECK-LABEL: name: widget
+ ; CHECK: bb.0:
+ ; CHECK-NEXT: successors: %bb.1(0x80000000)
+ ; CHECK-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $sgpr15
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION llvm_def_aspace_cfa $sgpr32, 0, 6
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION llvm_register_pair $pc_reg, $sgpr30, 32, $sgpr31, 32
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION undefined $vgpr0
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION undefined $agpr0
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION undefined $sgpr6
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION undefined $sgpr7
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION undefined $sgpr14
+ ; CHECK-NEXT: $sgpr6_sgpr7 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
+ ; CHECK-NEXT: $vgpr63 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec
+ ; CHECK-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr63, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: ("amdgpu-thread-private" store (s32) into %stack.0, addrspace 5)
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $agpr0, 0
+ ; CHECK-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 4, 0, 0, implicit $exec :: ("amdgpu-thread-private" store (s32) into %stack.1, addrspace 5)
+ ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $vgpr0, 256
+ ; CHECK-NEXT: $exec = S_MOV_B64 killed $sgpr6_sgpr7
+ ; CHECK-NEXT: $vgpr0 = IMPLICIT_DEF
+ ; CHECK-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr15, 0, killed $vgpr0
+ ; CHECK-NEXT: $sgpr6_sgpr7 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
+ ; CHECK-NEXT: $agpr0 = lr-split COPY killed $vgpr0
+ ; CHECK-NEXT: $exec = S_MOV_B64 killed $sgpr6_sgpr7
+ ; CHECK-NEXT: $vgpr0 = IMPLICIT_DEF
+ ; CHECK-NEXT: dead $vgpr0 = V_AND_B32_e32 1, killed $vgpr0, implicit $exec
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.1:
+ ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.2(0x40000000)
+ ; CHECK-NEXT: liveins: $agpr0
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
+ ; CHECK-NEXT: S_BRANCH %bb.3
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.2:
+ ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
+ ; CHECK-NEXT: liveins: $agpr0, $sgpr86, $sgpr87, $sgpr66_sgpr67, $sgpr68_sgpr69, $sgpr70_sgpr71, $sgpr80_sgpr81, $sgpr82_sgpr83, $sgpr84_sgpr85, $sgpr96_sgpr97, $sgpr98_sgpr99
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: S_CBRANCH_EXECNZ %bb.1, implicit $exec
+ ; CHECK-NEXT: S_BRANCH %bb.4
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.3:
+ ; CHECK-NEX...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/223278
More information about the llvm-commits
mailing list