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 | d78ebd0c6b97840c3778254653f8d71ca464905f (patch) | |
tree | a3e923f7ec9386a1867e4f41e38ba8caa0f07986 | |
parent | 96b903899826745eb223a893200ea7e617ea8853 (diff) | |
download | bcm5719-llvm-d78ebd0c6b97840c3778254653f8d71ca464905f.tar.gz bcm5719-llvm-d78ebd0c6b97840c3778254653f8d71ca464905f.zip |
Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
llvm-svn: 7243
-rw-r--r-- | llvm/lib/Transforms/Scalar/TailDuplication.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp index 04736f07e14..eea2096a9ef 100644 --- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp +++ b/llvm/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()) |