aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 80d3547e4b..b4f50e1929 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -309,7 +309,14 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
// are actually two values in the live interval. Because of this we
// need to take the LiveRegion that defines this register and split it
// into two values.
- unsigned DefIndex = getDefIndex(getInstructionIndex(vi.DefInst));
+ MachineRegisterInfo& MRI = mbb->getParent()->getRegInfo();
+ unsigned lowIndex = ~0U;
+ for (MachineRegisterInfo::def_iterator DI = MRI.def_begin(interval.reg),
+ DE = MRI.def_end(); DI != DE; ++DI)
+ if (getInstructionIndex(&*DI) < lowIndex)
+ lowIndex = getInstructionIndex(&*DI);
+
+ unsigned DefIndex = getDefIndex(lowIndex);
unsigned RedefIndex = getDefIndex(MIIdx);
const LiveRange *OldLR = interval.getLiveRangeContaining(RedefIndex-1);