mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[DCE] Add delete handler for phi erasure.
Set CallsChanged when appropriate and increment NumDeletedInsts.
This commit is contained in:
@@ -731,9 +731,17 @@ bool DCE::removeDead() {
|
||||
endLifetimeOfLiveValue(predOp, insertPt);
|
||||
}
|
||||
}
|
||||
erasePhiArgument(&BB, i, /*cleanupDeadPhiOps=*/true,
|
||||
InstModCallbacks().onCreateNewInst(
|
||||
[&](auto *inst) { markInstructionLive(inst); }));
|
||||
erasePhiArgument(
|
||||
&BB, i, /*cleanupDeadPhiOps=*/true,
|
||||
InstModCallbacks()
|
||||
.onCreateNewInst([&](auto *inst) { markInstructionLive(inst); })
|
||||
.onDelete([&](auto *inst) {
|
||||
inst->replaceAllUsesOfAllResultsWithUndef();
|
||||
if (isa<ApplyInst>(inst))
|
||||
CallsChanged = true;
|
||||
++NumDeletedInsts;
|
||||
inst->eraseFromParent();
|
||||
}));
|
||||
Changed = true;
|
||||
BranchesChanged = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user