[llvm-commits] [llvm] r108261 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jul 13 12:42:20 PDT 2010


Author: stoklund
Date: Tue Jul 13 14:42:20 2010
New Revision: 108261

URL: http://llvm.org/viewvc/llvm-project?rev=108261&view=rev
Log:
Fix LiveInterval::overlaps so it doesn't claim touching intervals overlap.
Also, one binary search is enough.

Modified:
    llvm/trunk/lib/CodeGen/LiveInterval.cpp

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=108261&r1=108260&r2=108261&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Jul 13 14:42:20 2010
@@ -161,16 +161,8 @@
 /// by [Start, End).
 bool LiveInterval::overlaps(SlotIndex Start, SlotIndex End) const {
   assert(Start < End && "Invalid range");
-  const_iterator I  = begin();
-  const_iterator E  = end();
-  const_iterator si = std::upper_bound(I, E, Start);
-  const_iterator ei = std::upper_bound(I, E, End);
-  if (si != ei)
-    return true;
-  if (si == I)
-    return false;
-  --si;
-  return si->contains(Start);
+  const_iterator I = std::lower_bound(begin(), end(), End);
+  return I != begin() && (--I)->end > Start;
 }
 
 /// extendIntervalEndTo - This method is used when we want to extend the range





More information about the llvm-commits mailing list