mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-05 09:24:28 +00:00
Allow tail duplication in more cases, relaxing the previous restriction a
bit. This fixes Regression/Transforms/TailDup/MergeTest.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30237 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -144,8 +144,19 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) {
|
|||||||
// if (b)
|
// if (b)
|
||||||
// foo();
|
// foo();
|
||||||
// Cloning the 'if b' block into the end of the first foo block is messy.
|
// Cloning the 'if b' block into the end of the first foo block is messy.
|
||||||
|
|
||||||
|
// The messy case is when the fall-through block falls through to other
|
||||||
|
// blocks. This is what we would be preventing if we cloned the block.
|
||||||
|
DestI = Dest;
|
||||||
|
if (++DestI != Dest->getParent()->end()) {
|
||||||
|
BasicBlock *DestSucc = DestI;
|
||||||
|
// If any of Dest's successors are fall-throughs, don't do this xform.
|
||||||
|
for (succ_iterator SI = succ_begin(Dest), SE = succ_end(Dest);
|
||||||
|
SI != SE; ++SI)
|
||||||
|
if (*SI == DestSucc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user