Skip to content

Commit a8b7227

Browse files
authored
[Inliner] Pass updated SCC to InlineAdvisor::onPassExit() (#96553)
InitialC may be logically invalid, although iterating through it doesn't crash. Always use the updated SCC.
1 parent 2df2373 commit a8b7227

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Transforms/IPO/Inliner.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
223223
InlineAdvisor &Advisor = getAdvisor(MAMProxy, FAM, M);
224224
Advisor.onPassEntry(&InitialC);
225225

226-
auto AdvisorOnExit = make_scope_exit([&] { Advisor.onPassExit(&InitialC); });
227-
228226
// We use a single common worklist for calls across the entire SCC. We
229227
// process these in-order and append new calls introduced during inlining to
230228
// the end. The PriorityInlineOrder is optional here, in which the smaller
@@ -279,12 +277,15 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
279277
}
280278
}
281279
}
282-
if (Calls.empty())
283-
return PreservedAnalyses::all();
284280

285281
// Capture updatable variable for the current SCC.
286282
auto *C = &InitialC;
287283

284+
auto AdvisorOnExit = make_scope_exit([&] { Advisor.onPassExit(C); });
285+
286+
if (Calls.empty())
287+
return PreservedAnalyses::all();
288+
288289
// When inlining a callee produces new call sites, we want to keep track of
289290
// the fact that they were inlined from the callee. This allows us to avoid
290291
// infinite inlining in some obscure cases. To represent this, we use an

0 commit comments

Comments
 (0)