summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-10-13 19:27:48 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-10-13 19:27:48 +0000
commit52ffa6711b967770f08ebb606a649c3afb9f5e66 (patch)
treea2e15422236abe98492f4c910ae96fdb9bfe7752 /llvm/lib/CodeGen
parent4b369572435797b49186347a6c9d4500bbfe895a (diff)
downloadbcm5719-llvm-52ffa6711b967770f08ebb606a649c3afb9f5e66.tar.gz
bcm5719-llvm-52ffa6711b967770f08ebb606a649c3afb9f5e66.zip
[RAGreedy] Empty live-ranges always succeed in last chance recoloring.
Relax the constraint for empty live-ranges while doing last chance recoloring. Indeed, those live-ranges do not need an actual color to be fond for the recoloring to work. Empty live-range may happen as a result of splitting/spilling. Unfortunately no test case for in-tree targets. llvm-svn: 284152
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 644b80bd008..188021c2832 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -2223,10 +2223,21 @@ bool RAGreedy::tryRecoloringCandidates(PQueue &RecoloringQueue,
DEBUG(dbgs() << "Try to recolor: " << *LI << '\n');
unsigned PhysReg;
PhysReg = selectOrSplitImpl(*LI, NewVRegs, FixedRegisters, Depth + 1);
- if (PhysReg == ~0u || !PhysReg)
+ // When splitting happens, the live-range may actually be empty.
+ // In that case, this is okay to continue the recoloring even
+ // if we did not find an alternative color for it. Indeed,
+ // there will not be anything to color for LI in the end.
+ if (PhysReg == ~0u || (!PhysReg && !LI->empty()))
return false;
+
+ if (!PhysReg) {
+ assert(LI->empty() && "Only empty live-range do not require a register");
+ DEBUG(dbgs() << "Recoloring of " << *LI << " succeeded. Empty LI.\n");
+ continue;
+ }
DEBUG(dbgs() << "Recoloring of " << *LI
<< " succeeded with: " << PrintReg(PhysReg, TRI) << '\n');
+
Matrix->assign(*LI, PhysReg);
FixedRegisters.insert(LI->reg);
}
OpenPOWER on IntegriCloud