return true;
if (i->start > j->start) {
- swap(i, j);
- swap(ie, je);
+ std::swap(i, j);
+ std::swap(ie, je);
}
assert(i->start < j->start);
// Otherwise if the span we are removing is at the end of the LiveRange,
// adjust the other way.
if (I->end == End) {
- I->start = Start;
+ I->end = Start;
return;
}
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;