From b394a7b7128ea7a64e96cd88b0dc656e681707ce Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 30 Apr 2012 17:41:42 +0000 Subject: Merging r155813: ------------------------------------------------------------------------ r155813 | void | 2012-04-30 02:23:48 -0700 (Mon, 30 Apr 2012) | 1 line Remove hack from r154987. The problem persists even with it, so it's not even a good hack. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_31@155831 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopUnswitch.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 04b825b168..7e485b8113 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -420,15 +420,6 @@ bool LoopUnswitch::processCurrentLoop() { if (!BranchesInfo.countLoop(currentLoop)) return false; - // Loops with invokes, whose unwind edge escapes the loop, cannot be - // unswitched because splitting their edges are non-trivial and don't preserve - // loop simplify information. - for (Loop::block_iterator I = currentLoop->block_begin(), - E = currentLoop->block_end(); I != E; ++I) - if (const InvokeInst *II = dyn_cast((*I)->getTerminator())) - if (!currentLoop->contains(II->getUnwindDest())) - return false; - // Loop over all of the basic blocks in the loop. If we find an interior // block that is branching on a loop-invariant condition, we can unswitch this // loop. @@ -633,11 +624,10 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val, /// LoopCond == Val to simplify the loop. If we decide that this is profitable, /// unswitch the loop, reprocess the pieces, then return true. bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) { - Function *F = loopHeader->getParent(); - Constant *CondVal = 0; BasicBlock *ExitBlock = 0; + if (IsTrivialUnswitchCondition(LoopCond, &CondVal, &ExitBlock)) { // If the condition is trivial, always unswitch. There is no code growth // for this case. -- cgit v1.2.3-18-g5258