Fix an exotic bug that only showed up in an internal test case.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 15 Jun 2010 18:49:14 +0000 (18:49 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 15 Jun 2010 18:49:14 +0000 (18:49 +0000)
SimpleRegisterCoalescing::JoinIntervals() uses CoalescerPair to determine if a
copy is coalescable, and in very rare cases it can return true where LHS is not
live - the coalescable copy can come from an alias of the physreg in LHS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106021 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SimpleRegisterCoalescing.cpp

index 16d929bbfa3616ff854e1790297f3aca83940ce5..6f3fc99a0ca32f8e0cdb3dd73274dd03bde9d90c 100644 (file)
@@ -2310,7 +2310,8 @@ SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RHS,
 
       // Figure out the value # from the RHS.
       LiveRange *lr = RHS.getLiveRangeContaining(VNI->def.getPrevSlot());
-      assert(lr && "Cannot find live range");
+      // The copy could be to an aliased physreg.
+      if (!lr) continue;
       LHSValsDefinedFromRHS[VNI] = lr->valno;
     }
 
@@ -2329,7 +2330,8 @@ SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RHS,
 
       // Figure out the value # from the LHS.
       LiveRange *lr = LHS.getLiveRangeContaining(VNI->def.getPrevSlot());
-      assert(lr && "Cannot find live range");
+      // The copy could be to an aliased physreg.
+      if (!lr) continue;
       RHSValsDefinedFromLHS[VNI] = lr->valno;
     }