[llvm-branch-commits] [llvm] [AMDGPU] Allocate scratch space for dVGPRs for CWSR (PR #130055)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 6 23:09:47 PST 2025


================
@@ -511,6 +511,14 @@ SIRegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC,
 Register SIRegisterInfo::getFrameRegister(const MachineFunction &MF) const {
   const SIFrameLowering *TFI = ST.getFrameLowering();
   const SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
+
+  // If we need to reserve scratch space for saving the VGPRs, then we should
+  // use the frame register for accessing our own frame (which may start at a
+  // non-zero offset).
+  if (TFI->mayReserveScratchForCWSR(MF))
+    return TFI->hasFP(MF) ? FuncInfo->getFrameOffsetReg()
----------------
arsenm wrote:

Why not just make hasFP true if mayReserveScratchForCWSR

https://github.com/llvm/llvm-project/pull/130055


More information about the llvm-branch-commits mailing list