[PATCH] D89806: [AMDGPU] Remove getAllVGPR32() which cannot handle Accum VGPRs properly
Venkata Ramanaiah Nalamothu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 09:42:55 PDT 2020
RamNalamothu created this revision.
RamNalamothu added reviewers: scott.linder, rampitec, t-tye, ashi1.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm, qcolombet.
Herald added a project: LLVM.
RamNalamothu requested review of this revision.
Herald added a subscriber: wdng.
Remove getAllVGPR32() interface and update the SGPR spill code to use
a proper method to get the relevant VGPR registers list.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89806
Files:
llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
llvm/lib/Target/AMDGPU/SIRegisterInfo.h
Index: llvm/lib/Target/AMDGPU/SIRegisterInfo.h
===================================================================
--- llvm/lib/Target/AMDGPU/SIRegisterInfo.h
+++ llvm/lib/Target/AMDGPU/SIRegisterInfo.h
@@ -326,10 +326,6 @@
/// of the subtarget.
ArrayRef<MCPhysReg> getAllSGPR32(const MachineFunction &MF) const;
- /// Return all VGPR32 which satisfy the waves per execution unit requirement
- /// of the subtarget.
- ArrayRef<MCPhysReg> getAllVGPR32(const MachineFunction &MF) const;
-
private:
void buildSpillLoadStore(MachineBasicBlock::iterator MI,
unsigned LoadStoreOp,
Index: llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -1989,8 +1989,3 @@
SIRegisterInfo::getAllSGPR32(const MachineFunction &MF) const {
return makeArrayRef(AMDGPU::SGPR_32RegClass.begin(), ST.getMaxNumSGPRs(MF));
}
-
-ArrayRef<MCPhysReg>
-SIRegisterInfo::getAllVGPR32(const MachineFunction &MF) const {
- return makeArrayRef(AMDGPU::VGPR_32RegClass.begin(), ST.getMaxNumVGPRs(MF));
-}
Index: llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
+++ llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
@@ -242,19 +242,14 @@
// If there are no free lower VGPRs available, default to using the
// pre-reserved register instead.
- Register LowestAvailableVGPR = PreReservedVGPR;
-
- MachineRegisterInfo &MRI = MF.getRegInfo();
- MachineFrameInfo &FrameInfo = MF.getFrameInfo();
- ArrayRef<MCPhysReg> AllVGPR32s = ST.getRegisterInfo()->getAllVGPR32(MF);
- for (MCPhysReg Reg : AllVGPR32s) {
- if (MRI.isAllocatable(Reg) && !MRI.isPhysRegUsed(Reg)) {
- LowestAvailableVGPR = Reg;
- break;
- }
- }
+ const SIRegisterInfo *TRI = ST.getRegisterInfo();
+ Register LowestAvailableVGPR =
+ TRI->findUnusedRegister(MF.getRegInfo(), &AMDGPU::VGPR_32RegClass, MF);
+ if (!LowestAvailableVGPR)
+ LowestAvailableVGPR = PreReservedVGPR;
const MCPhysReg *CSRegs = MF.getRegInfo().getCalleeSavedRegs();
+ MachineFrameInfo &FrameInfo = MF.getFrameInfo();
Optional<int> FI;
// Check if we are reserving a CSR. Create a stack object for a possible spill
// in the function prologue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89806.299389.patch
Type: text/x-patch
Size: 2401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201020/11577ccb/attachment.bin>
More information about the llvm-commits
mailing list