Be more careful when modifying PHI nodes. Patch by Andre Tavares.
authorNick Lewycky <nicholas@mxc.ca>
Wed, 19 Aug 2009 06:24:33 +0000 (06:24 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 19 Aug 2009 06:24:33 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/SSI.cpp

index 7bb9495f3cf9e1032aeaec39b325ee1e97d8c7ec..b4e683417cc370031427b97ad662c92cc0094286 100644 (file)
@@ -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<PHINode>(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));