From: Devang Patel Date: Wed, 1 Nov 2006 23:04:45 +0000 (+0000) Subject: There can be more than one PHINode at the start of the block. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e0805a2d36ac1c27b6e1bb2eb3ccddfd14b2f908;p=oota-llvm.git There can be more than one PHINode at the start of the block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31362 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp index d7aa7eca266..703105fac68 100644 --- a/lib/Transforms/Scalar/CondPropagate.cpp +++ b/lib/Transforms/Scalar/CondPropagate.cpp @@ -196,11 +196,10 @@ void CondProp::RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB) { // 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(ToBB->begin())) { - PHINode *PN = cast(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(ToBB->begin())) { assert(PN->getNumIncomingValues() == 1 && "Critical Edge Found!"); PN->replaceAllUsesWith(PN->getIncomingValue(0)); PN->eraseFromParent();