mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Fix PR255: [tailduplication] Single basic block loops are very rare
Note that this is a band-aid put over a band-aid. This just undisables tail duplication in on very specific case that it seems to work in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11989 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -125,6 +125,7 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) {
|
|||||||
bool TailDup::canEliminateUnconditionalBranch(TerminatorInst *TI) {
|
bool TailDup::canEliminateUnconditionalBranch(TerminatorInst *TI) {
|
||||||
// Basically, we refuse to make the transformation if any of the values
|
// Basically, we refuse to make the transformation if any of the values
|
||||||
// computed in the 'tail' are used in any other basic blocks.
|
// computed in the 'tail' are used in any other basic blocks.
|
||||||
|
BasicBlock *BB = TI->getParent();
|
||||||
BasicBlock *Tail = TI->getSuccessor(0);
|
BasicBlock *Tail = TI->getSuccessor(0);
|
||||||
assert(isa<BranchInst>(TI) && cast<BranchInst>(TI)->isUnconditional());
|
assert(isa<BranchInst>(TI) && cast<BranchInst>(TI)->isUnconditional());
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ bool TailDup::canEliminateUnconditionalBranch(TerminatorInst *TI) {
|
|||||||
for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
|
for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
|
||||||
++UI) {
|
++UI) {
|
||||||
Instruction *User = cast<Instruction>(*UI);
|
Instruction *User = cast<Instruction>(*UI);
|
||||||
if (User->getParent() != Tail || isa<PHINode>(User))
|
if (User->getParent() != Tail && User->getParent() != BB)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user