[llvm-commits] [llvm] r106021 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jun 15 11:49:14 PDT 2010


Author: stoklund
Date: Tue Jun 15 13:49:14 2010
New Revision: 106021

URL: http://llvm.org/viewvc/llvm-project?rev=106021&view=rev
Log:
Fix an exotic bug that only showed up in an internal test case.

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.

Modified:
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=106021&r1=106020&r2=106021&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Jun 15 13:49:14 2010
@@ -2310,7 +2310,8 @@
 
       // 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 @@
 
       // 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;
     }
 





More information about the llvm-commits mailing list