diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-08 21:36:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-08 21:36:34 +0000 |
commit | caf5b504a378208b75dffbda5a64a3940da21f52 (patch) | |
tree | 41291b53bf572e1b3a207bdf2aa86d84a241c4ef /llvm/lib/VMCore/BasicBlock.cpp | |
parent | a704ac8a660f68d1e0b434abdf56aa9a8c1233cc (diff) | |
download | bcm5719-llvm-caf5b504a378208b75dffbda5a64a3940da21f52.tar.gz bcm5719-llvm-caf5b504a378208b75dffbda5a64a3940da21f52.zip |
Changes to support PHINode::removeIncoming changes
llvm-svn: 4080
Diffstat (limited to 'llvm/lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | llvm/lib/VMCore/BasicBlock.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 2f1072dc336..667346c9c18 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -183,16 +183,15 @@ void BasicBlock::removePredecessor(BasicBlock *Pred) { // Yup, loop through and nuke the PHI nodes while (PHINode *PN = dyn_cast<PHINode>(&front())) { PN->removeIncomingValue(Pred); // Remove the predecessor first... - - assert(PN->getNumIncomingValues() == max_idx-1 && - "PHI node shouldn't have this many values!!!"); // If the PHI _HAD_ two uses, replace PHI node with its now *single* value - if (max_idx == 2) + if (max_idx == 2) { PN->replaceAllUsesWith(PN->getOperand(0)); - else // Otherwise there are no incoming values/edges, replace with dummy - PN->replaceAllUsesWith(Constant::getNullValue(PN->getType())); - getInstList().pop_front(); // Remove the PHI node + getInstList().pop_front(); // Remove the PHI node + } + + // If the PHI node already only had one entry, it got deleted by + // removeIncomingValue. } } else { // Okay, now we know that we need to remove predecessor #pred_idx from all |