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 | dee430d26e14a3d7c8d86688d49ac8b116aa044f (patch) | |
tree | 916ba8a09761fe1fd92113e7e51b8c2e735a2b24 /lib/VMCore/BasicBlock.cpp | |
parent | bb190ac8dafdcc5e604da3695987d69ee8632195 (diff) |
Changes to support PHINode::removeIncoming changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4080 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 2f1072dc33..667346c9c1 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/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 |