diff options
author | Chris Lattner <sabre@nondot.org> | 2003-07-23 03:32:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-07-23 03:32:41 +0000 |
commit | 00f185fbfd99d21cda394eded77d1bc0ea2a4073 (patch) | |
tree | a704ad6a7f8bd5b3a0fbf4ceeb902403e862f43f /lib | |
parent | e1a875ef29106e9546fd3889eb27a39cad577cdf (diff) |
Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7243 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/TailDuplication.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 04736f07e1..eea2096a9e 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -76,6 +76,11 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) { BasicBlock *Dest = BI->getSuccessor(0); if (Dest == BI->getParent()) return false; // Do not loop infinitely! + // Do not inline a block if we will just get another branch to the same block! + if (BranchInst *DBI = dyn_cast<BranchInst>(Dest->getTerminator())) + if (DBI->isUnconditional() && DBI->getSuccessor(0) == Dest) + return false; // Do not loop infinitely! + // Do not bother working on dead blocks... pred_iterator PI = pred_begin(Dest), PE = pred_end(Dest); if (PI == PE && Dest != Dest->getParent()->begin()) |