[llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 8 16:37:04 PDT 2002


Changes in directory llvm/lib/VMCore:

BasicBlock.cpp updated: 1.26 -> 1.27

---
Log message:

Changes to support PHINode::removeIncoming changes


---
Diffs of the changes:

Index: llvm/lib/VMCore/BasicBlock.cpp
diff -u llvm/lib/VMCore/BasicBlock.cpp:1.26 llvm/lib/VMCore/BasicBlock.cpp:1.27
--- llvm/lib/VMCore/BasicBlock.cpp:1.26	Thu Sep 26 00:03:22 2002
+++ llvm/lib/VMCore/BasicBlock.cpp	Tue Oct  8 16:36:34 2002
@@ -183,16 +183,15 @@
     // 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





More information about the llvm-commits mailing list