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 | 3f0eb54d7f7bcfb8456eca6fd52cbfc4eee79f59 (patch) | |
| tree | 1b014258ef424f6497856b132c03ba26d76fb9ce /lib/CodeGen/LiveInterval.cpp | |
| parent | 5d12ab58a5078a2fea3bac109b17e158ce641a7e (diff) | |
| download | external_llvm-3f0eb54d7f7bcfb8456eca6fd52cbfc4eee79f59.zip external_llvm-3f0eb54d7f7bcfb8456eca6fd52cbfc4eee79f59.tar.gz external_llvm-3f0eb54d7f7bcfb8456eca6fd52cbfc4eee79f59.tar.bz2 | |
Fix LiveInterval::overlaps so it doesn't claim touching intervals overlap.
Also, one binary search is enough.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
| -rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index 21a9b7d..9b057b0 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/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 |
