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

Chris Lattner lattner at cs.uiuc.edu
Thu Oct 20 15:50:22 PDT 2005



Changes in directory llvm/lib/CodeGen:

LiveInterval.cpp updated: 1.25 -> 1.26
---
Log message:

Fix a conditional so we don't access past the end of the range.  Thanks to
Andrew for bringing this to my attn.


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

 LiveInterval.cpp |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/LiveInterval.cpp
diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.25 llvm/lib/CodeGen/LiveInterval.cpp:1.26
--- llvm/lib/CodeGen/LiveInterval.cpp:1.25	Thu Oct 20 11:56:40 2005
+++ llvm/lib/CodeGen/LiveInterval.cpp	Thu Oct 20 17:50:10 2005
@@ -218,12 +218,10 @@
   
   // If the newly formed range now touches the range after it and if they have
   // the same value number, merge the two ranges into one range.
-  if (I != ranges.end()) {
-    Ranges::iterator Next = next(I);
-    if (Next->start == I->end && Next->ValId == ValId) {
-      I->end = Next->end;
-      ranges.erase(Next);
-    }
+  Ranges::iterator Next = next(I);
+  if (Next != ranges.end() && Next->start == I->end && Next->ValId == ValId) {
+    I->end = Next->end;
+    ranges.erase(Next);
   }
 }
 






More information about the llvm-commits mailing list