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

Devang Patel dpatel at apple.com
Thu Dec 8 15:52:00 PST 2011


Author: dpatel
Date: Thu Dec  8 17:52:00 2011
New Revision: 146205

URL: http://llvm.org/viewvc/llvm-project?rev=146205&view=rev
Log:
Revert r146184. I am seeing performance regression cause by this patch in one test case.

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=146205&r1=146204&r2=146205&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineSink.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineSink.cpp Thu Dec  8 17:52:00 2011
@@ -485,16 +485,6 @@
       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, SuccBlock, ParentBlock,
                                     BreakPHIEdge, LocalUse)) {
@@ -511,6 +501,17 @@
         return NULL;
     }
   }
+
+  // It is not possible to sink an instruction into its own block.  This can
+  // happen with loops.
+  if (ParentBlock == SuccToSinkTo)
+    return NULL;
+
+  // It's not safe to sink instructions to EH landing pad. Control flow into
+  // landing pad is implicitly defined.
+  if (SuccToSinkTo && SuccToSinkTo->isLandingPad())
+    return NULL;
+
   return SuccToSinkTo;
 }
 





More information about the llvm-commits mailing list