[llvm-commits] [llvm] r159746 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp
Chandler Carruth
chandlerc at gmail.com
Thu Jul 5 05:40:45 PDT 2012
Author: chandlerc
Date: Thu Jul 5 07:40:45 2012
New Revision: 159746
URL: http://llvm.org/viewvc/llvm-project?rev=159746&view=rev
Log:
Optimize extendIntervalEndTo a tiny bit by saving one call through the
vector erase. No functionality changed.
Modified:
llvm/trunk/lib/CodeGen/LiveInterval.cpp
Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=159746&r1=159745&r2=159746&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Thu Jul 5 07:40:45 2012
@@ -196,16 +196,16 @@
// 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);
}
More information about the llvm-commits
mailing list