diff options
author | Dan Gohman <gohman@apple.com> | 2009-11-05 19:21:41 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-11-05 19:21:41 +0000 |
commit | f17e9511f15a0e007ff47d0789d1a52502e8c1fb (patch) | |
tree | 306d9b4c3d0fbc314e0dad22a2b0137bb4eb5498 /lib/Analysis/LoopInfo.cpp | |
parent | b5b10c25f72f983f5876c0091cc98be36a6a3f0a (diff) |
Factor out the predicate code for loopsimplify form exit blocks into
a separate helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | lib/Analysis/LoopInfo.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index e9256b7414..b5f407dfdc 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -286,12 +286,14 @@ bool Loop::isLCSSAForm() const { /// the LoopSimplify form transforms loops to, which is sometimes called /// normal form. bool Loop::isLoopSimplifyForm() const { - // Normal-form loops have a preheader. - if (!getLoopPreheader()) - return false; - // Normal-form loops have a single backedge. - if (!getLoopLatch()) - return false; + // Normal-form loops have a preheader, a single backedge, and all of their + // exits have all their predecessors inside the loop. + return getLoopPreheader() && getLoopLatch() && hasDedicatedExits(); +} + +/// hasDedicatedExits - Return true if no exit block for the loop +/// has a predecessor that is outside the loop. +bool Loop::hasDedicatedExits() const { // Sort the blocks vector so that we can use binary search to do quick // lookups. SmallPtrSet<BasicBlock *, 16> LoopBBs(block_begin(), block_end()); |