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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 16:07:25 PDT 2015


arsenm updated this revision to Diff 31625.
arsenm added a comment.

Use .getRegSlot()


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.getRegSlot());
+
+      DEBUG(NCDSGPRUse->dump());
     }
   }
 


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


More information about the llvm-commits mailing list