summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp b/llvm/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
index b469898bef5..b91649e54f9 100644
--- a/llvm/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp
@@ -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::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());
}
}
OpenPOWER on IntegriCloud