From b43455feaf5161f9688c8782fdf469a874765e37 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 13 Jul 2010 19:42:20 +0000 Subject: Fix LiveInterval::overlaps so it doesn't claim touching intervals overlap. Also, one binary search is enough. llvm-svn: 108261 --- llvm/lib/CodeGen/LiveInterval.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'llvm/lib/CodeGen/LiveInterval.cpp') diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 21a9b7d4db6..9b057b0fec2 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -161,16 +161,8 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other, /// 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 -- cgit v1.2.3