diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-07-13 19:42:20 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-07-13 19:42:20 +0000 |
commit | b43455feaf5161f9688c8782fdf469a874765e37 (patch) | |
tree | 951ec03f3a0a070d34ef673b261e141e824980ff /llvm/lib/CodeGen/LiveInterval.cpp | |
parent | 8406c5197b7f3315e32db21b637504f33560c6bd (diff) | |
download | bcm5719-llvm-b43455feaf5161f9688c8782fdf469a874765e37.tar.gz bcm5719-llvm-b43455feaf5161f9688c8782fdf469a874765e37.zip |
Fix LiveInterval::overlaps so it doesn't claim touching intervals overlap.
Also, one binary search is enough.
llvm-svn: 108261
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
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 |