From 3417e8f185e9d866df6a604976237e2f0a5e5deb 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79407 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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)); -- 2.34.1