Skip to content

Commit 08a9c12

Browse files
authored
fix #45440, improve the robustness of concrete-evaled callsite inlining (#45451)
1 parent 991190f commit 08a9c12

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

base/compiler/ssair/inlining.jl

+9-5
Original file line numberDiff line numberDiff line change
@@ -788,20 +788,20 @@ end
788788

789789
function compileable_specialization(et::Union{EdgeTracker, Nothing}, match::MethodMatch, effects::Effects)
790790
mi = specialize_method(match; compilesig=true)
791-
mi !== nothing && et !== nothing && push!(et, mi::MethodInstance)
792791
mi === nothing && return nothing
792+
et !== nothing && push!(et, mi)
793793
return InvokeCase(mi, effects)
794794
end
795795

796796
function compileable_specialization(et::Union{EdgeTracker, Nothing}, linfo::MethodInstance, effects::Effects)
797797
mi = specialize_method(linfo.def::Method, linfo.specTypes, linfo.sparam_vals; compilesig=true)
798-
mi !== nothing && et !== nothing && push!(et, mi::MethodInstance)
799798
mi === nothing && return nothing
799+
et !== nothing && push!(et, mi)
800800
return InvokeCase(mi, effects)
801801
end
802802

803-
function compileable_specialization(et::Union{EdgeTracker, Nothing}, (; linfo)::InferenceResult, effects::Effects)
804-
return compileable_specialization(et, linfo, effects)
803+
function compileable_specialization(et::Union{EdgeTracker, Nothing}, result::InferenceResult, effects::Effects)
804+
return compileable_specialization(et, result.linfo, effects)
805805
end
806806

807807
function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
@@ -1283,7 +1283,11 @@ function handle_const_call!(
12831283
any_fully_covered |= match.fully_covers
12841284
if isa(result, ConcreteResult)
12851285
case = concrete_result_item(result, state)
1286-
push!(cases, InliningCase(result.mi.specTypes, case))
1286+
if case === nothing
1287+
handled_all_cases = false
1288+
else
1289+
push!(cases, InliningCase(result.mi.specTypes, case))
1290+
end
12871291
elseif isa(result, ConstPropResult)
12881292
handled_all_cases &= handle_const_prop_result!(result, argtypes, flag, state, cases, true)
12891293
else

0 commit comments

Comments
 (0)