aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-24 16:09:17 +0000
committerChris Lattner <sabre@nondot.org>2002-09-24 16:09:17 +0000
commit929b2c6900e20859f338d808a1a89ffc5b3563bb (patch)
treef64b67534859fc471b60351f7e7a6ca498d2a1fe /lib/Transforms/Utils/SimplifyCFG.cpp
parentd7490bcf9a51e3688150f1f5be3d21a0bcf288b6 (diff)
Fix bug: SimplifyCFG/2002-09-24-PHIAssertion.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3913 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index f7eaa67acf..341b5ac37d 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -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();