Fix bug: SimplifyCFG/2002-09-24-PHIAssertion.ll
authorChris Lattner <sabre@nondot.org>
Tue, 24 Sep 2002 16:09:17 +0000 (16:09 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 24 Sep 2002 16:09:17 +0000 (16:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3913 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/SimplifyCFG.cpp

index f7eaa67acf7d9545f7a25d85910758841ab48122..341b5ac37db75f671709452c12a9c506c88d51f1 100644 (file)
@@ -167,15 +167,16 @@ bool SimplifyCFG(BasicBlock *BB) {
       TerminatorInst *Term = OnlyPred->getTerminator();
 
       // Resolve any PHI nodes at the start of the block.  They are all
-      // guaranteed to have exactly one entry if they exist.
+      // guaranteed to have exactly one entry if they exist, unless there are
+      // multiple duplicate (but guaranteed to be equal) entries for the
+      // incoming edges.  This occurs when there are multiple edges from
+      // OnlyPred to OnlySucc.
       //
       while (PHINode *PN = dyn_cast<PHINode>(&BB->front())) {
-        assert(PN->getNumIncomingValues() == 1 && "Only one pred!");
         PN->replaceAllUsesWith(PN->getIncomingValue(0));
         BB->getInstList().pop_front();  // Delete the phi node...
       }
 
-
       // Delete the unconditional branch from the predecessor...
       OnlyPred->getInstList().pop_back();