mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Fix 12513: Loop unrolling breaks with indirect branches.
Take this opportunity to generalize the indirectbr bailout logic for loop transformations. CFG transformations will never get indirectbr right, and there's no point trying. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154386 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -205,6 +205,17 @@ bool Loop::isLoopSimplifyForm() const {
|
||||
return getLoopPreheader() && getLoopLatch() && hasDedicatedExits();
|
||||
}
|
||||
|
||||
/// isSafeToClone - Return true if the loop body is safe to clone in practice.
|
||||
/// Routines that reform the loop CFG and split edges often fail on indirectbr.
|
||||
bool Loop::isSafeToClone() const {
|
||||
// Return false if any loop blocks contain indirectbrs.
|
||||
for (Loop::block_iterator I = block_begin(), E = block_end(); I != E; ++I) {
|
||||
if (isa<IndirectBrInst>((*I)->getTerminator()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// hasDedicatedExits - Return true if no exit block for the loop
|
||||
/// has a predecessor that is outside the loop.
|
||||
bool Loop::hasDedicatedExits() const {
|
||||
|
Reference in New Issue
Block a user