Skip to content

Commit 8bca2f4

Browse files
committed
fix #45440, improve the robustness of concrete-evaled callsite inlining
1 parent 2cf85b6 commit 8bca2f4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

base/compiler/ssair/inlining.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,20 +735,20 @@ end
735735

736736
function compileable_specialization(et::Union{EdgeTracker, Nothing}, match::MethodMatch, effects::Effects)
737737
mi = specialize_method(match; compilesig=true)
738-
mi !== nothing && et !== nothing && push!(et, mi::MethodInstance)
739738
mi === nothing && return nothing
739+
et !== nothing && push!(et, mi)
740740
return InvokeCase(mi, effects)
741741
end
742742

743743
function compileable_specialization(et::Union{EdgeTracker, Nothing}, linfo::MethodInstance, effects::Effects)
744744
mi = specialize_method(linfo.def::Method, linfo.specTypes, linfo.sparam_vals; compilesig=true)
745-
mi !== nothing && et !== nothing && push!(et, mi::MethodInstance)
746745
mi === nothing && return nothing
746+
et !== nothing && push!(et, mi)
747747
return InvokeCase(mi, effects)
748748
end
749749

750-
function compileable_specialization(et::Union{EdgeTracker, Nothing}, (; linfo)::InferenceResult, effects::Effects)
751-
return compileable_specialization(et, linfo, effects)
750+
function compileable_specialization(et::Union{EdgeTracker, Nothing}, result::InferenceResult, effects::Effects)
751+
return compileable_specialization(et, result.linfo, effects)
752752
end
753753

754754
function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
@@ -1257,7 +1257,11 @@ function handle_const_call!(
12571257
result = results[j]
12581258
if isa(result, ConstResult)
12591259
case = const_result_item(result, state)
1260-
push!(cases, InliningCase(result.mi.specTypes, case))
1260+
if case === nothing
1261+
fully_covered = false
1262+
else
1263+
push!(cases, InliningCase(result.mi.specTypes, case))
1264+
end
12611265
elseif isa(result, InferenceResult)
12621266
fully_covered &= handle_inf_result!(result, argtypes, flag, state, cases)
12631267
else

0 commit comments

Comments
 (0)