Fix SingleSource/Regression/C/2005-05-06-LongLongSignedShift.c, we were not
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index 3c7e8dd763216f1eea5d20c2764330e54cc78c37..a8bc1615b4113c364ef2cc462e20607634136fc3 100644 (file)
@@ -68,27 +68,29 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other,
   const_iterator je = other.end();
 
   assert((StartPos->start <= i->start || StartPos == other.begin()) &&
-         "Bogus start position hint!");
+         StartPos != other.end() && "Bogus start position hint!");
 
   if (i->start < j->start) {
     i = std::upper_bound(i, ie, j->start);
     if (i != ranges.begin()) --i;
   } else if (j->start < i->start) {
-    j = std::upper_bound(j, je, i->start);
-    if (j != other.ranges.begin()) --j;
+    ++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;
+    }
   } else {
     return true;
   }
 
-  while (i != ie && j != je) {
-    if (i->start == j->start)
-      return true;
+  if (j == je) return false;
 
+  while (i != ie) {
     if (i->start > j->start) {
       std::swap(i, j);
       std::swap(ie, je);
     }
-    assert(i->start < j->start);
 
     if (i->end > j->start)
       return true;