Fix SingleSource/Regression/C/2005-05-06-LongLongSignedShift.c, we were not
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index 80a6ed290c713516a154a4d52bde2f9e25692197..a8bc1615b4113c364ef2cc462e20607634136fc3 100644 (file)
@@ -74,7 +74,9 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other,
     i = std::upper_bound(i, ie, j->start);
     if (i != ranges.begin()) --i;
   } else if (j->start < i->start) {
-    if ((++StartPos)->start <= i->start) {
+    ++StartPos;
+    if (StartPos != other.end() && StartPos->start <= i->start) {
+      assert(StartPos < other.end() && i < end());
       j = std::upper_bound(j, je, i->start);
       if (j != other.ranges.begin()) --j;
     }
@@ -82,7 +84,9 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other,
     return true;
   }
 
-  while (i != ie && j != je) {
+  if (j == je) return false;
+
+  while (i != ie) {
     if (i->start > j->start) {
       std::swap(i, j);
       std::swap(ie, je);