[llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Jul 22 22:33:01 PDT 2003
Changes in directory llvm/lib/Transforms/Scalar:
TailDuplication.cpp updated: 1.4 -> 1.5
---
Log message:
Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
---
Diffs of the changes:
Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.4 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.5
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.4 Tue Jun 24 14:48:06 2003
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp Tue Jul 22 22:32:41 2003
@@ -76,6 +76,11 @@
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())
More information about the llvm-commits
mailing list