diff options
author | Devang Patel <dpatel@apple.com> | 2006-11-01 23:04:45 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-11-01 23:04:45 +0000 |
commit | 2cb4f83b384ce673e6f33c81220e3c97cb03de66 (patch) | |
tree | 12044b770f8376c9444f09013804585464e7912e /llvm/lib/Transforms | |
parent | 3557a3949448e0c2fbc4acca6789b1e4d82f6879 (diff) | |
download | bcm5719-llvm-2cb4f83b384ce673e6f33c81220e3c97cb03de66.tar.gz bcm5719-llvm-2cb4f83b384ce673e6f33c81220e3c97cb03de66.zip |
There can be more than one PHINode at the start of the block.
llvm-svn: 31362
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/CondPropagate.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/CondPropagate.cpp b/llvm/lib/Transforms/Scalar/CondPropagate.cpp index d7aa7eca266..703105fac68 100644 --- a/llvm/lib/Transforms/Scalar/CondPropagate.cpp +++ b/llvm/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<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(); |