[llvm-commits] [llvm] r146184 - /llvm/trunk/lib/CodeGen/MachineSink.cpp

Devang Patel dpatel at apple.com
Thu Dec 8 13:33:24 PST 2011


Author: dpatel
Date: Thu Dec  8 15:33:23 2011
New Revision: 146184

URL: http://llvm.org/viewvc/llvm-project?rev=146184&view=rev
Log:
Filter "sink to" candidate blocks sooner. This avoids unnecessary computation to determine whether the block dominates all uses or not.

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

Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSink.cpp?rev=146184&r1=146183&r2=146184&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineSink.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineSink.cpp Thu Dec  8 15:33:23 2011
@@ -499,10 +499,21 @@
       // we should sink to.
       for (MachineBasicBlock::succ_iterator SI = ParentBlock->succ_begin(),
            E = ParentBlock->succ_end(); SI != E; ++SI) {
+	MachineBasicBlock *SuccBlock = *SI;
+	// It is not possible to sink an instruction into its own block.  This can
+	// happen with loops.
+	if (ParentBlock == SuccBlock)
+	  continue;
+
+	// It's not safe to sink instructions to EH landing pad. Control flow into
+	// landing pad is implicitly defined.
+	if (SuccBlock->isLandingPad())
+	  continue;
+
         bool LocalUse = false;
-        if (AllUsesDominatedByBlock(Reg, *SI, ParentBlock,
+        if (AllUsesDominatedByBlock(Reg, SuccBlock, ParentBlock,
                                     BreakPHIEdge, LocalUse)) {
-          SuccToSinkTo = *SI;
+          SuccToSinkTo = SuccBlock;
           break;
         }
         if (LocalUse)
@@ -520,15 +531,6 @@
   if (SuccToSinkTo == 0)
     return false;
 
-  // It's not safe to sink instructions to EH landing pad. Control flow into
-  // landing pad is implicitly defined.
-  if (SuccToSinkTo->isLandingPad())
-    return false;
-
-  // It is not possible to sink an instruction into its own block.  This can
-  // happen with loops.
-  if (MI->getParent() == SuccToSinkTo)
-    return false;
 
   // If the instruction to move defines a dead physical register which is live
   // when leaving the basic block, don't move it because it could turn into a





More information about the llvm-commits mailing list