[llvm] r245133 - AMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 17:12:35 PDT 2015


Author: arsenm
Date: Fri Aug 14 19:12:35 2015
New Revision: 245133

URL: http://llvm.org/viewvc/llvm-project?rev=245133&view=rev
Log:
AMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges

Does not mark SlotIndexes as reserved, although I think
that might be OK.

LiveVariables still need to be handled.

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp?rev=245133&r1=245132&r2=245133&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp Fri Aug 14 19:12:35 2015
@@ -81,6 +81,10 @@ public:
     AU.addRequired<LiveIntervals>();
     AU.addRequired<MachinePostDominatorTree>();
     AU.setPreservesCFG();
+
+    //AU.addPreserved<SlotIndexes>(); // XXX - This might be OK
+    AU.addPreserved<LiveIntervals>();
+
     MachineFunctionPass::getAnalysisUsage(AU);
   }
 };
@@ -181,10 +185,15 @@ bool SIFixSGPRLiveRanges::runOnMachineFu
 
       // 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());
     }
   }
 




More information about the llvm-commits mailing list