[PATCH] D11888: AMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 15:22:48 PDT 2015


arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.
Herald added a subscriber: MatzeB.

Does not mark SlotIndexes as reserved, although I think that might be OK.
    
LiveVariables still need to be handled.

http://reviews.llvm.org/D11888

Files:
  lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp

Index: lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
===================================================================
--- lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
+++ lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
@@ -81,6 +81,10 @@
     AU.addRequired<LiveIntervals>();
     AU.addRequired<MachinePostDominatorTree>();
     AU.setPreservesCFG();
+
+    //AU.addPreserved<SlotIndexes>(); // XXX - This might be OK
+    AU.addPreserved<LiveIntervals>();
+
     MachineFunctionPass::getAnalysisUsage(AU);
   }
 };
@@ -194,10 +198,15 @@
 
       // FIXME: Need to figure out how to update LiveRange here so this pass
       // will be able to preserve LiveInterval analysis.
-      BuildMI(*NCD, NCD->getFirstNonPHI(), DebugLoc(),
-              TII->get(AMDGPU::SGPR_USE))
-              .addReg(Reg, RegState::Implicit);
-      DEBUG(NCD->getFirstNonPHI()->dump());
+      MachineInstr *NCDSGPRUse =
+        BuildMI(*NCD, NCD->getFirstNonPHI(), DebugLoc(),
+                TII->get(AMDGPU::SGPR_USE))
+        .addReg(Reg, RegState::Implicit);
+
+      SlotIndex SI = LIS->InsertMachineInstrInMaps(NCDSGPRUse);
+      LIS->extendToIndices(*LR, SI);
+
+      DEBUG(NCDSGPRUse->dump());
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11888.31623.patch
Type: text/x-patch
Size: 1195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150809/ddf31a84/attachment.bin>


More information about the llvm-commits mailing list