From de125a796225368585a94c0558177a20985b489c Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sat, 15 Aug 2015 00:12:35 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245133 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp b/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp index b469898bef5..b91649e54f9 100644 --- a/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp +++ b/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp @@ -81,6 +81,10 @@ public: AU.addRequired(); AU.addRequired(); AU.setPreservesCFG(); + + //AU.addPreserved(); // XXX - This might be OK + AU.addPreserved(); + MachineFunctionPass::getAnalysisUsage(AU); } }; @@ -181,10 +185,15 @@ bool SIFixSGPRLiveRanges::runOnMachineFunction(MachineFunction &MF) { // 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()); } } -- 2.34.1