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
This commit is contained in:
Nick Lewycky 2009-08-19 06:24:33 +00:00
parent 663c2d2580
commit 3417e8f185

View 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));