Only run CoalesceExtSubRegs when we can expect LiveIntervalAnalysis to clean up
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 18 Jun 2010 23:10:20 +0000 (23:10 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 18 Jun 2010 23:10:20 +0000 (23:10 +0000)
the inserted INSERT_SUBREGs after us.

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

lib/CodeGen/TwoAddressInstructionPass.cpp

index 048b6698a733da192ed5283e784b0f8f2b7e4bdc..14102d1f3dd1708f4572c084adf0941ca143d384 100644 (file)
@@ -1397,8 +1397,11 @@ bool TwoAddressInstructionPass::EliminateRegSequences() {
       MI->eraseFromParent();
     }
 
-    // Try coalescing some EXTRACT_SUBREG instructions.
-    CoalesceExtSubRegs(RealSrcs, DstReg);
+    // Try coalescing some EXTRACT_SUBREG instructions. This can create
+    // INSERT_SUBREG instructions that must have <undef> flags added by
+    // LiveIntervalAnalysis, so only run it when LiveVariables is available.
+    if (LV)
+      CoalesceExtSubRegs(RealSrcs, DstReg);
   }
 
   RegSequences.clear();