1
Fork 0

inline: move should inline check

This commit is contained in:
David Wood 2024-12-12 15:58:24 +00:00
parent 5f316f5e00
commit dbec6bedf4
No known key found for this signature in database

View file

@ -502,11 +502,6 @@ fn process_blocks<'tcx, I: Inliner<'tcx>>(
let span = trace_span!("process_blocks", %callsite.callee, ?bb);
let _guard = span.enter();
if !inliner.should_inline_for_callee(callsite.callee.def_id()) {
debug!("not enabled");
continue;
}
match try_inlining(inliner, caller_body, &callsite) {
Err(reason) => {
debug!("not-inlined {} [{}]", callsite.callee, reason);
@ -541,6 +536,11 @@ fn resolve_callsite<'tcx, I: Inliner<'tcx>>(
if let TerminatorKind::Call { ref func, fn_span, .. } = terminator.kind {
let func_ty = func.ty(caller_body, tcx);
if let ty::FnDef(def_id, args) = *func_ty.kind() {
if !inliner.should_inline_for_callee(def_id) {
debug!("not enabled");
return None;
}
// To resolve an instance its args have to be fully normalized.
let args = tcx.try_normalize_erasing_regions(inliner.typing_env(), args).ok()?;
let callee =