[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Sep 24 11:10:01 PDT 2002


Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.4 -> 1.5

---
Log message:

Fix bug: SimplifyCFG/2002-09-24-PHIAssertion.ll


---
Diffs of the changes:

Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.4 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.5
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.4	Mon Sep 23 19:09:26 2002
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp	Tue Sep 24 11:09:17 2002
@@ -167,14 +167,15 @@
       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();





More information about the llvm-commits mailing list