diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-29 06:41:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-29 06:41:20 +0000 |
commit | 4279f3c9845e1030877c81263aad35d2fa59e3f5 (patch) | |
tree | bb8cb24415b40736d61be106c50f41046a1df559 /lib/Transforms/Scalar/TailDuplication.cpp | |
parent | e9f6f2c0492af8097166f1b7d62f131f20ca5714 (diff) | |
download | external_llvm-4279f3c9845e1030877c81263aad35d2fa59e3f5.zip external_llvm-4279f3c9845e1030877c81263aad35d2fa59e3f5.tar.gz external_llvm-4279f3c9845e1030877c81263aad35d2fa59e3f5.tar.bz2 |
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
Diffstat (limited to 'lib/Transforms/Scalar/TailDuplication.cpp')
-rw-r--r-- | lib/Transforms/Scalar/TailDuplication.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 7d5aac4..315b906 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -125,6 +125,7 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) { bool TailDup::canEliminateUnconditionalBranch(TerminatorInst *TI) { // Basically, we refuse to make the transformation if any of the values // computed in the 'tail' are used in any other basic blocks. + BasicBlock *BB = TI->getParent(); BasicBlock *Tail = TI->getSuccessor(0); 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; ++UI) { Instruction *User = cast<Instruction>(*UI); - if (User->getParent() != Tail || isa<PHINode>(User)) + if (User->getParent() != Tail && User->getParent() != BB) return false; } return true; |