Merge pull request #64709 from meg-gupta/dcefix

Don't DCE @owned phis that may have escaped
This commit is contained in:
swift-ci
2023-03-29 14:26:45 -07:00
committed by GitHub
2 changed files with 26 additions and 4 deletions

View File

@@ -276,7 +276,8 @@ void DCE::markLive() {
}
case SILInstructionKind::DestroyValueInst: {
auto phi = PhiValue(I.getOperand(0));
if (phi && phi->isLexical()) {
// Disable DCE of phis which are lexical or may have a pointer escape.
if (phi && (phi->isLexical() || hasPointerEscape(phi))) {
markInstructionLive(&I);
}
break;