Don't replace a phi with an identical phi. This was done long ago to
"preserve" IVUsers analysis. The code has already called
SE->forgetValue(PN) so I see no purpose in creating a new value for
the phi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237587
91177308-0d34-0410-b5e6-
96231b3b80d8
PN->eraseFromParent();
}
}
-
- // If we were unable to completely replace the PHI node, clone the PHI and
- // delete the original one. This purges the original phi.
- if (!LCSSASafePhiForRAUW) {
- PHINode *NewPN = cast<PHINode>(PN->clone());
- NewPN->takeName(PN);
- NewPN->insertBefore(PN);
- PN->replaceAllUsesWith(NewPN);
- PN->eraseFromParent();
- }
}
}