[PATCH] D63673: AMDGPU: Cleanup checking when spills need emergency slots

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 14:53:20 PDT 2019


arsenm created this revision.
arsenm added a reviewer: rampitec.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.

Address fixme, which should no longer be a problem since r363757.


https://reviews.llvm.org/D63673

Files:
  lib/Target/AMDGPU/SIFrameLowering.cpp


Index: lib/Target/AMDGPU/SIFrameLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIFrameLowering.cpp
+++ lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -721,10 +721,13 @@
   }
 }
 
-static bool allStackObjectsAreDead(const MachineFrameInfo &MFI) {
+// Note SGPRSpill stack IDs should only be used for SGPR spilling to VGPRs, not
+// memory.
+static bool allStackObjectsAreDeadOrSGPR(const MachineFrameInfo &MFI) {
   for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd();
        I != E; ++I) {
-    if (!MFI.isDeadObjectIndex(I))
+    if (!MFI.isDeadObjectIndex(I) &&
+        MFI.getStackID(I) != TargetStackID::SGPRSpill)
       return false;
   }
 
@@ -786,11 +789,7 @@
 
   FuncInfo->removeSGPRToVGPRFrameIndices(MFI);
 
-  // FIXME: The other checks should be redundant with allStackObjectsAreDead,
-  // but currently hasNonSpillStackObjects is set only from source
-  // allocas. Stack temps produced from legalization are not counted currently.
-  if (FuncInfo->hasNonSpillStackObjects() || FuncInfo->hasSpilledVGPRs() ||
-      !AllSGPRSpilledToVGPRs || !allStackObjectsAreDead(MFI)) {
+  if (!allStackObjectsAreDeadOrSGPR(MFI)) {
     assert(RS && "RegScavenger required if spilling");
 
     if (FuncInfo->isEntryFunction()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63673.206085.patch
Type: text/x-patch
Size: 1301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190621/9de1e21f/attachment.bin>


More information about the llvm-commits mailing list