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

Devang Patel dpatel at apple.com
Wed Nov 1 15:05:00 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

CondPropagate.cpp updated: 1.7 -> 1.8
---
Log message:

There can be more than one PHINode at the start of the block.


---
Diffs of the changes:  (+4 -5)

 CondPropagate.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/Scalar/CondPropagate.cpp
diff -u llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.7 llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.8
--- llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.7	Wed Nov  1 16:26:43 2006
+++ llvm/lib/Transforms/Scalar/CondPropagate.cpp	Wed Nov  1 17:04:45 2006
@@ -196,11 +196,10 @@
   // Get the old block we are threading through.
   BasicBlock *OldSucc = FromBr->getSuccessor(0);
 
-  // OldSucc had multiple successors. If ToBB has multiple predecessors, the
-  // edge between them would be critical, which we already took care of.
-  // If ToBB has single operand PHI node than take care of it here.
-  if (isa<PHINode>(ToBB->begin())) {
-    PHINode *PN = cast<PHINode>(ToBB->begin());
+  // OldSucc had multiple successors. If ToBB has multiple predecessors, then 
+  // the edge between them would be critical, which we already took care of.
+  // If ToBB has single operand PHI node then take care of it here.
+  while (PHINode *PN = dyn_cast<PHINode>(ToBB->begin())) {
     assert(PN->getNumIncomingValues() == 1 && "Critical Edge Found!");    
     PN->replaceAllUsesWith(PN->getIncomingValue(0));
     PN->eraseFromParent();






More information about the llvm-commits mailing list