summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitd6dcd8ec3225d1e45a1a43c4e4e078b3539dda8f (patch)
treee83480f4e742c58dd4ee03b61510cb99d6f270a6 /llvm/lib
parent710e9a5c657e18536ad03398771d7f7637682f2d (diff)
downloadbcm5719-llvm-d6dcd8ec3225d1e45a1a43c4e4e078b3539dda8f.tar.gz
bcm5719-llvm-d6dcd8ec3225d1e45a1a43c4e4e078b3539dda8f.zip
Fix bug: SimplifyCFG/2002-09-24-PHIAssertion.ll
llvm-svn: 3913
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index f7eaa67acf7..341b5ac37db 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud