From: Jakob Stoklund Olesen Date: Mon, 6 Feb 2012 21:52:18 +0000 (+0000) Subject: Make sure a reserved register has a live interval before merging. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=602cb9d9f2307913aa816abbe37fc158c79feb0a;p=oota-llvm.git 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 --- diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index cc9ec3ce142..c7be0b31e0a 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -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;