Temporarily revert 124765 in an attempt to find the cycle breaking bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124778 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index d970c7d..2b30c31 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -645,6 +645,9 @@
LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs);
SplitEditor SE(*SA, *LIS, *VRM, *DomTree, LREdit);
+ // Ranges to add to the register interval after all defs are in place.
+ SmallVector<IndexPair, 8> UseRanges;
+
// Create the main cross-block interval.
SE.openIntv();
@@ -681,7 +684,7 @@
if (!BI.LiveThrough) {
DEBUG(dbgs() << ", not live-through.\n");
SE.enterIntvBefore(BI.Def);
- SE.useIntv(BI.Def, Stop);
+ UseRanges.push_back(IndexPair(BI.Def, Stop));
continue;
}
if (!RegIn) {
@@ -689,7 +692,7 @@
// Reload just before the first use.
DEBUG(dbgs() << ", not live-in, enter before first use.\n");
SE.enterIntvBefore(BI.FirstUse);
- SE.useIntv(BI.FirstUse, Stop);
+ UseRanges.push_back(IndexPair(BI.FirstUse, Stop));
continue;
}
DEBUG(dbgs() << ", live-through.\n");
@@ -714,7 +717,7 @@
DEBUG(dbgs() << ", free use at " << Use << ".\n");
assert(Use <= BI.LastUse && "Couldn't find last use");
SE.enterIntvBefore(Use);
- SE.useIntv(Use, Stop);
+ UseRanges.push_back(IndexPair(Use, Stop));
continue;
}
@@ -723,6 +726,12 @@
SE.enterIntvAtEnd(*BI.MBB);
}
+ // Add the live-out ranges following the defs.
+ // We must wait until all defs have been inserted, otherwise SplitKit gets
+ // confused about the value mapping.
+ for (unsigned i = 0, e = UseRanges.size(); i != e; ++i)
+ SE.useIntv(UseRanges[i].first, UseRanges[i].second);
+
// Now all defs leading to live bundles are handled, do everything else.
for (unsigned i = 0, e = LiveBlocks.size(); i != e; ++i) {
BlockInfo &BI = LiveBlocks[i];