diff options
| author | Bill Wendling <isanbard@gmail.com> | 2012-04-19 23:31:07 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2012-04-19 23:31:07 +0000 |
| commit | 9f97595201488f9ff66ba0a5e26d1da19cfc817f (patch) | |
| tree | f339cb3eec7e2848f17ce8b814c75d5bc5292c67 /llvm/lib | |
| parent | d783617c259d9098e0384b950a8dbaf9e4f81839 (diff) | |
| download | bcm5719-llvm-9f97595201488f9ff66ba0a5e26d1da19cfc817f.tar.gz bcm5719-llvm-9f97595201488f9ff66ba0a5e26d1da19cfc817f.zip | |
Put this expensive check below the less expensive ones.
llvm-svn: 155166
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 00ecc749af0..04b825b168f 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/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. |

