mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
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
This commit is contained in:
@ -572,6 +572,10 @@ public:
|
|||||||
/// normal form.
|
/// normal form.
|
||||||
bool isLoopSimplifyForm() const;
|
bool isLoopSimplifyForm() const;
|
||||||
|
|
||||||
|
/// hasDedicatedExits - Return true if no exit block for the loop
|
||||||
|
/// has a predecessor that is outside the loop.
|
||||||
|
bool hasDedicatedExits() const;
|
||||||
|
|
||||||
/// getUniqueExitBlocks - Return all unique successor blocks of this loop.
|
/// getUniqueExitBlocks - Return all unique successor blocks of this loop.
|
||||||
/// These are the blocks _outside of the current loop_ which are branched to.
|
/// These are the blocks _outside of the current loop_ which are branched to.
|
||||||
/// This assumes that loop is in canonical form.
|
/// This assumes that loop is in canonical form.
|
||||||
|
@ -286,12 +286,14 @@ bool Loop::isLCSSAForm() const {
|
|||||||
/// the LoopSimplify form transforms loops to, which is sometimes called
|
/// the LoopSimplify form transforms loops to, which is sometimes called
|
||||||
/// normal form.
|
/// normal form.
|
||||||
bool Loop::isLoopSimplifyForm() const {
|
bool Loop::isLoopSimplifyForm() const {
|
||||||
// Normal-form loops have a preheader.
|
// Normal-form loops have a preheader, a single backedge, and all of their
|
||||||
if (!getLoopPreheader())
|
// exits have all their predecessors inside the loop.
|
||||||
return false;
|
return getLoopPreheader() && getLoopLatch() && hasDedicatedExits();
|
||||||
// Normal-form loops have a single backedge.
|
}
|
||||||
if (!getLoopLatch())
|
|
||||||
return false;
|
/// 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
|
// Sort the blocks vector so that we can use binary search to do quick
|
||||||
// lookups.
|
// lookups.
|
||||||
SmallPtrSet<BasicBlock *, 16> LoopBBs(block_begin(), block_end());
|
SmallPtrSet<BasicBlock *, 16> LoopBBs(block_begin(), block_end());
|
||||||
|
Reference in New Issue
Block a user