mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-19 02:03:11 +00:00
Allow tail duplication in more cases, relaxing the previous restriction a
bit. This fixes Regression/Transforms/TailDup/MergeTest.ll llvm-svn: 30237
This commit is contained in:
parent
480465a171
commit
2921612126
@ -144,7 +144,18 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) {
|
||||
// if (b)
|
||||
// foo();
|
||||
// Cloning the 'if b' block into the end of the first foo block is messy.
|
||||
return false;
|
||||
|
||||
// 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 true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user