From ed3dcdbdb8f99555230f23ee0f1d59e7c7528b4f Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 19 Aug 2009 06:24:33 +0000 Subject: [PATCH] Be more careful when modifying PHI nodes. Patch by Andre Tavares. llvm-svn: 79407 --- lib/Transforms/Utils/SSI.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Utils/SSI.cpp b/lib/Transforms/Utils/SSI.cpp index 7bb9495f3cf..b4e683417cc 100644 --- a/lib/Transforms/Utils/SSI.cpp +++ b/lib/Transforms/Utils/SSI.cpp @@ -316,7 +316,8 @@ void SSI::fixPhis() { for (unsigned i = 0, e = PN->getNumIncomingValues(); i < e; ++i) { PHINode *PN_father; if ((PN_father = dyn_cast(PN->getIncomingValue(i))) && - PN->getParent() == PN_father->getParent()) { + PN->getParent() == PN_father->getParent() && + !DT_->dominates(PN->getParent(), PN->getIncomingBlock(i))) { BasicBlock *BB = PN->getIncomingBlock(i); int pos = PN_father->getBasicBlockIndex(BB); PN->setIncomingValue(i, PN_father->getIncomingValue(pos));