Lower llvm.isunordered(a, b) into a != a | b != b.
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index 4a1720f7013b616434efdaa969c10dc9824a6428..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,15 +84,13 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other,
     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;