Skip to content

Commit 3bf2d20

Browse files
committed
inline: move should inline check
1 parent 5554988 commit 3bf2d20

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/rustc_mir_transform/src/inline.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,6 @@ fn process_blocks<'tcx, I: Inliner<'tcx>>(
502502
let span = trace_span!("process_blocks", %callsite.callee, ?bb);
503503
let _guard = span.enter();
504504

505-
if !inliner.should_inline_for_callee(callsite.callee.def_id()) {
506-
debug!("not enabled");
507-
continue;
508-
}
509-
510505
match try_inlining(inliner, caller_body, &callsite) {
511506
Err(reason) => {
512507
debug!("not-inlined {} [{}]", callsite.callee, reason);
@@ -541,6 +536,11 @@ fn resolve_callsite<'tcx, I: Inliner<'tcx>>(
541536
if let TerminatorKind::Call { ref func, fn_span, .. } = terminator.kind {
542537
let func_ty = func.ty(caller_body, tcx);
543538
if let ty::FnDef(def_id, args) = *func_ty.kind() {
539+
if !inliner.should_inline_for_callee(def_id) {
540+
debug!("not enabled");
541+
return None;
542+
}
543+
544544
// To resolve an instance its args have to be fully normalized.
545545
let args = tcx.try_normalize_erasing_regions(inliner.typing_env(), args).ok()?;
546546
let callee =

0 commit comments

Comments
 (0)