diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-19 15:16:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-19 15:16:53 +0000 |
commit | 8640f4e666086cc6e7447dc164105e428e6cb81a (patch) | |
tree | 91fc67cf4499ed182e1ef88116c680c95f1789d2 /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | cc0d156f7bca0811aade0a95b0e7419176383c90 (diff) |
Fix a bug that occurs when the last instruction in a range is dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index ebf9dcd2dd..5fa725724a 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -205,12 +205,15 @@ std::vector<LiveInterval*> LiveIntervals::addIntervalsForSpills( const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(li.reg); for (LiveInterval::Ranges::const_iterator - i = li.ranges.begin(), e = li.ranges.end(); i != e; ++i) { + i = li.ranges.begin(), e = li.ranges.end(); i != e; ++i) { unsigned index = getBaseIndex(i->first); unsigned end = getBaseIndex(i->second-1) + InstrSlots::NUM; - for (; index < end; index += InstrSlots::NUM) { + for (; index != end; index += InstrSlots::NUM) { // skip deleted instructions - while (!getInstructionFromIndex(index)) index += InstrSlots::NUM; + while (index != end && !getInstructionFromIndex(index)) + index += InstrSlots::NUM; + if (index == end) break; + MachineBasicBlock::iterator mi = getInstructionFromIndex(index); for_operand: |