about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorDavid Wood <david.wood2@arm.com>2024-12-12 15:58:24 +0000
committerDavid Wood <david.wood2@arm.com>2025-01-10 18:37:56 +0000
commitdbec6bedf41d22a511d2d6a2637ff79ca75ec548 (patch)
tree13f3555944faf23f3ab94be1532d33b829bafff5 /compiler
parent5f316f5e0025ffa9ed31e01becf549fd73e61ed4 (diff)
downloadrust-dbec6bedf41d22a511d2d6a2637ff79ca75ec548.tar.gz
rust-dbec6bedf41d22a511d2d6a2637ff79ca75ec548.zip
inline: move should inline check
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 1f390200381..44c6d8190f1 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -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 =