summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-19 15:16:53 +0000
committerChris Lattner <sabre@nondot.org>2004-07-19 15:16:53 +0000
commit15dfdb4e013f8694a83285dc08e318ad1ed25411 (patch)
treeffa1fc6cdf5fca48ba76a89dfd92a2b5a107e82b /llvm/lib/CodeGen
parentc8fb1fb5bb3f36fe5af05e727ddff6ed403adbac (diff)
downloadbcm5719-llvm-15dfdb4e013f8694a83285dc08e318ad1ed25411.tar.gz
bcm5719-llvm-15dfdb4e013f8694a83285dc08e318ad1ed25411.zip
Fix a bug that occurs when the last instruction in a range is dead
llvm-svn: 15005
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveIntervals.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp
index ebf9dcd2dd1..5fa725724ac 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.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:
OpenPOWER on IntegriCloud