[PATCH] D70379: [AMDGPU] Reserving VGPR for future SGPR Spill

Saiyedul Islam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 02:56:21 PST 2019


saiislam updated this revision to Diff 229782.
saiislam added a comment.

Corrected formatting


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70379/new/

https://reviews.llvm.org/D70379

Files:
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp


Index: llvm/lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -100,6 +100,10 @@
   cl::desc("Do not align and prefetch loops"),
   cl::init(false));
 
+static cl::opt<bool> VGPRReserveforSGPRSpill(
+    "amdgpu-reserve-vgpr-for-sgpr-spill",
+    cl::desc("Allocates one VGPR for future SGPR Spill"), cl::init(false));
+
 static unsigned findFirstFreeSGPR(CCState &CCInfo) {
   unsigned NumSGPRs = AMDGPU::SGPR_32RegClass.getNumRegs();
   for (unsigned Reg = 0; Reg < NumSGPRs; ++Reg) {
@@ -10790,6 +10794,15 @@
   }
 
   TargetLoweringBase::finalizeLowering(MF);
+
+  // Allocate a VGPR for future SGPR Spill if
+  // "amdgpu-reserve-vgpr-for-sgpr-spill" option is used
+  if (VGPRReserveforSGPRSpill) {
+    int fi = MF.getFrameInfo().CreateStackObject(4, 4, false, nullptr,
+                                                 TargetStackID::SGPRSpill);
+    Info->allocateSGPRSpillToVGPR(MF, fi);
+    MF.getFrameInfo().RemoveStackObject(fi);
+  }
 }
 
 void SITargetLowering::computeKnownBitsForFrameIndex(const SDValue Op,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70379.229782.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191118/e849e946/attachment.bin>


More information about the llvm-commits mailing list