aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-06 21:52:18 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-06 21:52:18 +0000
commit602cb9d9f2307913aa816abbe37fc158c79feb0a (patch)
treeb55e0cda3749d1a9e73e5b9d2dcaec5e737ca57f
parent8833ef03b9ceaa52063116819fff8b3d16fd8933 (diff)
downloadexternal_llvm-602cb9d9f2307913aa816abbe37fc158c79feb0a.zip
external_llvm-602cb9d9f2307913aa816abbe37fc158c79feb0a.tar.gz
external_llvm-602cb9d9f2307913aa816abbe37fc158c79feb0a.tar.bz2
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
-rw-r--r--lib/CodeGen/RegisterCoalescer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp
index cc9ec3c..c7be0b3 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;