[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jul 19 08:17:03 PDT 2004



Changes in directory llvm/lib/CodeGen:

LiveIntervals.cpp updated: 1.96 -> 1.97

---
Log message:

Fix a bug that occurs when the last instruction in a range is dead


---
Diffs of the changes:  (+6 -3)

Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.96 llvm/lib/CodeGen/LiveIntervals.cpp:1.97
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.96	Mon Jul 19 09:40:29 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp	Mon Jul 19 10:16:53 2004
@@ -205,12 +205,15 @@
     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:





More information about the llvm-commits mailing list