Make sure a reserved register has a live interval before merging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149910 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-02-06 21:52:18 +00:00
parent 8833ef03b9
commit 602cb9d9f2

View File

@ -1414,8 +1414,12 @@ bool RegisterCoalescer::JoinIntervals(CoalescerPair &CP) {
// Deny any overlapping intervals. This depends on all the reserved
// register live ranges to look like dead defs.
for (const unsigned *AS = TRI->getOverlaps(CP.getDstReg()); *AS; ++AS) {
if (!LIS->hasInterval(*AS))
if (!LIS->hasInterval(*AS)) {
// Make sure at least DstReg itself exists before attempting a join.
if (*AS == CP.getDstReg())
LIS->getOrCreateInterval(CP.getDstReg());
continue;
}
if (RHS.overlaps(LIS->getInterval(*AS))) {
DEBUG(dbgs() << "\t\tInterference: " << PrintReg(*AS, TRI) << '\n');
return false;