Skip to content

Commit 8fb0fd2

Browse files
committed
[TempRValueOpt] Invalidate insts when completing.
1 parent 2eb3a86 commit 8fb0fd2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/SILOptimizer/Transforms/TempRValueElimination.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,15 +958,18 @@ void TempRValueOptPass::run() {
958958
simplifyAndReplaceAllSimplifiedUsesAndErase(srcInst, callbacks, &deBlocks);
959959
}
960960
}
961-
if (!deadCopies.empty()) {
962-
invalidateAnalysis(SILAnalysis::InvalidationKind::Instructions);
963-
}
964961

965962
// Call the utlity to complete ossa lifetime.
963+
bool completedAny = false;
966964
OSSALifetimeCompletion completion(function, da->get(function), deBlocks);
967965
for (auto it : valuesToComplete) {
968-
completion.completeOSSALifetime(it,
969-
OSSALifetimeCompletion::Boundary::Liveness);
966+
auto completed = completion.completeOSSALifetime(
967+
it, OSSALifetimeCompletion::Boundary::Liveness);
968+
completedAny = (completed == LifetimeCompletion::WasCompleted);
969+
}
970+
971+
if (!deadCopies.empty() || completedAny) {
972+
invalidateAnalysis(SILAnalysis::InvalidationKind::Instructions);
970973
}
971974
}
972975

0 commit comments

Comments
 (0)