summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-24 03:41:50 +0000
committerChris Lattner <sabre@nondot.org>2004-07-24 03:41:50 +0000
commitd9bbbb8484c19a33effc16342b484c614e923a7d (patch)
tree9bb78facf6213b5a32c4e270a6d9bd471cb733ea /llvm/lib/CodeGen/LiveInterval.cpp
parentc51866a20e86173036c245285361879ba6d64132 (diff)
downloadbcm5719-llvm-d9bbbb8484c19a33effc16342b484c614e923a7d.tar.gz
bcm5719-llvm-d9bbbb8484c19a33effc16342b484c614e923a7d.zip
In the joiner, merge the small interval into the large interval. This restores
us back to taking about 10.5s on gcc, instead of taking 15.6s! The net result is that my big patches have hand no significant effect on compile time or code quality. heh. llvm-svn: 15156
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 1cd9fb1a4a8..79aa710c03b 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -260,6 +260,15 @@ void LiveInterval::join(LiveInterval &Other, unsigned CopyIdx) {
unsigned MergedSrcValIdx = SourceLR->ValId;
unsigned MergedDstValIdx = DestLR->ValId;
+ // Try to do the least amount of work possible. In particular, if there are
+ // more liverange chunks in the other set than there are in the 'this' set,
+ // swap sets to merge the fewest chunks in possible.
+ if (Other.ranges.size() > ranges.size()) {
+ std::swap(MergedSrcValIdx, MergedDstValIdx);
+ std::swap(ranges, Other.ranges);
+ std::swap(NumValues, Other.NumValues);
+ }
+
// Join the ranges of other into the ranges of this interval.
Ranges::iterator InsertPos = ranges.begin();
std::map<unsigned, unsigned> Dst2SrcIdxMap;
OpenPOWER on IntegriCloud