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.

llvm-svn: 245133
This commit is contained in:
Matt Arsenault 2015-08-15 00:12:35 +00:00
parent b75233235c
commit 670ba46efe
1 changed files with 13 additions and 4 deletions

View File

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