summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-07-05 12:40:45 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-07-05 12:40:45 +0000
commit95c88b8cb210ffad127519a143fade685ab21f5b (patch)
tree24499459da55732df856e0e88e8e38fea54e6dab /lib/CodeGen/LiveInterval.cpp
parent39c2a3d219021c14a4dd2552cc0b277fd0e3f702 (diff)
downloadllvm-95c88b8cb210ffad127519a143fade685ab21f5b.tar.gz
llvm-95c88b8cb210ffad127519a143fade685ab21f5b.tar.bz2
llvm-95c88b8cb210ffad127519a143fade685ab21f5b.tar.xz
Optimize extendIntervalEndTo a tiny bit by saving one call through the
vector erase. No functionality changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 8990360a72..3d34c089b9 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -196,16 +196,16 @@ void LiveInterval::extendIntervalEndTo(Ranges::iterator I, SlotIndex NewEnd) {
// If NewEnd was in the middle of an interval, make sure to get its endpoint.
I->end = std::max(NewEnd, prior(MergeTo)->end);
- // Erase any dead ranges.
- ranges.erase(llvm::next(I), MergeTo);
-
// If the newly formed range now touches the range after it and if they have
// the same value number, merge the two ranges into one range.
- Ranges::iterator Next = llvm::next(I);
- if (Next != ranges.end() && Next->start <= I->end && Next->valno == ValNo) {
- I->end = Next->end;
- ranges.erase(Next);
+ if (MergeTo != ranges.end() && MergeTo->start <= I->end &&
+ MergeTo->valno == ValNo) {
+ I->end = MergeTo->end;
+ ++MergeTo;
}
+
+ // Erase any dead ranges.
+ ranges.erase(llvm::next(I), MergeTo);
}