[llvm-commits] [llvm] r155166 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Bill Wendling
isanbard at gmail.com
Thu Apr 19 16:31:07 PDT 2012
Author: void
Date: Thu Apr 19 18:31:07 2012
New Revision: 155166
URL: http://llvm.org/viewvc/llvm-project?rev=155166&view=rev
Log:
Put this expensive check below the less expensive ones.
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=155166&r1=155165&r2=155166&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Apr 19 18:31:07 2012
@@ -409,15 +409,6 @@
if (!currentLoop->isSafeToClone())
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;
-
// Without dedicated exits, splitting the exit edge may fail.
if (!currentLoop->hasDedicatedExits())
return false;
@@ -429,6 +420,15 @@
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.
More information about the llvm-commits
mailing list