[llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 29 00:42:01 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

TailDuplication.cpp updated: 1.13 -> 1.14

---
Log message:

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.


---
Diffs of the changes:  (+2 -1)

Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.13 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.14
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.13	Sat Feb 21 23:25:17 2004
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp	Sun Feb 29 00:41:20 2004
@@ -125,6 +125,7 @@
 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 @@
     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;





More information about the llvm-commits mailing list