From 785c860bc5bb6a230415c837e2e85000c04cc78e Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Tue, 22 Oct 2024 16:01:46 -0700 Subject: [PATCH] Fix inlining for nightly --- src/compiler/interpreter.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/compiler/interpreter.jl b/src/compiler/interpreter.jl index 937f61e77d..0bd75c545a 100644 --- a/src/compiler/interpreter.jl +++ b/src/compiler/interpreter.jl @@ -247,6 +247,7 @@ let # overload `inlining_policy` argtypes::Vector{Any}, ) end + @static isdefined(Core.Compiler, :inlining_policy) @eval function Core.Compiler.inlining_policy($(sigs_ex.args...)) if info isa NoInlineCallInfo if info.kind === :primitive @@ -266,6 +267,27 @@ let # overload `inlining_policy` end return @invoke Core.Compiler.inlining_policy($(args_ex.args...)) end + else + @eval function Core.Compiler.src_inlining_policy($(sigs_ex.args...)) + if info isa NoInlineCallInfo + if info.kind === :primitive + @safe_debug "Blocking inlining for primitive func" info.tt + elseif info.kind === :inactive + @safe_debug "Blocking inlining due to inactive rule" info.tt + elseif info.kind === :frule + @safe_debug "Blocking inlining due to frule" info.tt + else + @assert info.kind === :rrule + @safe_debug "Blocking inlining due to rrule" info.tt + end + return nothing + elseif info isa AlwaysInlineCallInfo + @safe_debug "Forcing inlining for primitive func" info.tt + return src + end + return @invoke Core.Compiler.src_inlining_policy($(args_ex.args...)) + end + end end import Core.Compiler: