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

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 29 01:58:00 PDT 2004


Changes in directory llvm/lib/CodeGen:

LiveIntervals.cpp updated: 1.79 -> 1.80

---
Log message:

Do not dereference end iterators.  It hurts when you do that.


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

Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.79 llvm/lib/CodeGen/LiveIntervals.cpp:1.80
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.79	Thu Jun 24 19:13:11 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp	Tue Jun 29 01:56:51 2004
@@ -356,8 +356,7 @@
     }
 
     // a variable can only be killed by subsequent instructions
-    do {
-        ++mi;
+    for (++mi; mi != e; ++mi) {
         baseIndex += InstrSlots::NUM;
         for (KillIter ki = lv_->killed_begin(mi), ke = lv_->killed_end(mi);
              ki != ke; ++ki) {
@@ -367,7 +366,7 @@
                 goto exit;
             }
         }
-    } while (mi != e);
+    }
 
 exit:
     assert(start < end && "did not find end of interval?");





More information about the llvm-commits mailing list