From 7f7f0902a640c26e9ce70b5869fc7de3b8b27918 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 8 Dec 2011 23:52:00 +0000 Subject: Revert r146184. I am seeing performance regression cause by this patch in one test case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146205 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineSink.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib/CodeGen/MachineSink.cpp') diff --git a/lib/CodeGen/MachineSink.cpp b/lib/CodeGen/MachineSink.cpp index 7740a75e42..dff8109363 100644 --- a/lib/CodeGen/MachineSink.cpp +++ b/lib/CodeGen/MachineSink.cpp @@ -485,16 +485,6 @@ MachineBasicBlock *MachineSinking::FindSuccToSinkTo(MachineInstr *MI, 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 @@ MachineBasicBlock *MachineSinking::FindSuccToSinkTo(MachineInstr *MI, 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; } -- cgit v1.2.3