summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-04-30 17:40:59 +0000
committerBill Wendling <isanbard@gmail.com>2012-04-30 17:40:59 +0000
commit461573a1d6dcd3fce56037ff34f1fd8b7ccc2e4b (patch)
treefb47b718ee74f0cb1d868d97f81ae6b48cc8c126
parent8cd9fe4d54889d516451ee36d00f130a3140468b (diff)
downloadllvm-461573a1d6dcd3fce56037ff34f1fd8b7ccc2e4b.tar.gz
Merging r155166:
------------------------------------------------------------------------ r155166 | void | 2012-04-19 16:31:07 -0700 (Thu, 19 Apr 2012) | 1 line Put this expensive check below the less expensive ones. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_31@155830 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 00ecc749af05..04b825b168fa 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -409,15 +409,6 @@ bool LoopUnswitch::processCurrentLoop() {
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 @@ 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<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.