aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-02-18 04:38:37 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-02-18 04:38:37 +0000
commit23c114fd3bec342ac1a2a45801b892d6b4517afc (patch)
tree06e61ce7f62fc484786b6310152f630f361b8072 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent99d9923608bfd0feff288d667c3e4f94c4132c26 (diff)
Be more agressive when joining ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 5079ef822c..91de847e07 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -625,10 +625,10 @@ void LiveIntervals::Interval::join(const LiveIntervals::Interval& other)
LiveIntervals::Interval::Ranges::iterator
LiveIntervals::Interval::mergeRangesForward(Ranges::iterator it)
{
- for (Ranges::iterator next = it + 1;
- next != ranges.end() && it->second >= next->first; ) {
- it->second = std::max(it->second, next->second);
- next = ranges.erase(next);
+ for (Ranges::iterator n = next(it);
+ n != ranges.end() && ((it->second & 1) + it->second) >= n->first; ) {
+ it->second = std::max(it->second, n->second);
+ n = ranges.erase(n);
}
return it;
}
@@ -637,12 +637,12 @@ LiveIntervals::Interval::Ranges::iterator
LiveIntervals::Interval::mergeRangesBackward(Ranges::iterator it)
{
while (it != ranges.begin()) {
- Ranges::iterator prev = it - 1;
- if (it->first > prev->second) break;
+ Ranges::iterator p = prior(it);
+ if (it->first > ((p->second & 1) + p->second)) break;
- it->first = std::min(it->first, prev->first);
- it->second = std::max(it->second, prev->second);
- it = ranges.erase(prev);
+ it->first = std::min(it->first, p->first);
+ it->second = std::max(it->second, p->second);
+ it = ranges.erase(p);
}
return it;