forked from OSchip/llvm-project
There can be more than one PHINode at the start of the block.
llvm-svn: 31362
This commit is contained in:
parent
3557a39494
commit
2cb4f83b38
|
@ -196,11 +196,10 @@ void CondProp::RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB) {
|
||||||
// Get the old block we are threading through.
|
// Get the old block we are threading through.
|
||||||
BasicBlock *OldSucc = FromBr->getSuccessor(0);
|
BasicBlock *OldSucc = FromBr->getSuccessor(0);
|
||||||
|
|
||||||
// OldSucc had multiple successors. If ToBB has multiple predecessors, the
|
// OldSucc had multiple successors. If ToBB has multiple predecessors, then
|
||||||
// edge between them would be critical, which we already took care of.
|
// 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 ToBB has single operand PHI node then take care of it here.
|
||||||
if (isa<PHINode>(ToBB->begin())) {
|
while (PHINode *PN = dyn_cast<PHINode>(ToBB->begin())) {
|
||||||
PHINode *PN = cast<PHINode>(ToBB->begin());
|
|
||||||
assert(PN->getNumIncomingValues() == 1 && "Critical Edge Found!");
|
assert(PN->getNumIncomingValues() == 1 && "Critical Edge Found!");
|
||||||
PN->replaceAllUsesWith(PN->getIncomingValue(0));
|
PN->replaceAllUsesWith(PN->getIncomingValue(0));
|
||||||
PN->eraseFromParent();
|
PN->eraseFromParent();
|
||||||
|
|
Loading…
Reference in New Issue