[llvm-commits] [llvm] r155813 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Bill Wendling
isanbard at gmail.com
Mon Apr 30 02:23:48 PDT 2012
Author: void
Date: Mon Apr 30 04:23:48 2012
New Revision: 155813
URL: http://llvm.org/viewvc/llvm-project?rev=155813&view=rev
Log:
Remove hack from r154987. The problem persists even with it, so it's not even a good hack.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=155813&r1=155812&r2=155813&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Apr 30 04:23:48 2012
@@ -420,15 +420,6 @@
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<InvokeInst>((*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 @@
/// 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.
More information about the llvm-commits
mailing list