Skip to content

Commit

Permalink
fix #45440, improve the robustness of concrete-evaled callsite inlini…
Browse files Browse the repository at this point in the history
…ng (#45451)
  • Loading branch information
aviatesk authored May 25, 2022
1 parent 991190f commit 08a9c12
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -788,20 +788,20 @@ end

function compileable_specialization(et::Union{EdgeTracker, Nothing}, match::MethodMatch, effects::Effects)
mi = specialize_method(match; compilesig=true)
mi !== nothing && et !== nothing && push!(et, mi::MethodInstance)
mi === nothing && return nothing
et !== nothing && push!(et, mi)
return InvokeCase(mi, effects)
end

function compileable_specialization(et::Union{EdgeTracker, Nothing}, linfo::MethodInstance, effects::Effects)
mi = specialize_method(linfo.def::Method, linfo.specTypes, linfo.sparam_vals; compilesig=true)
mi !== nothing && et !== nothing && push!(et, mi::MethodInstance)
mi === nothing && return nothing
et !== nothing && push!(et, mi)
return InvokeCase(mi, effects)
end

function compileable_specialization(et::Union{EdgeTracker, Nothing}, (; linfo)::InferenceResult, effects::Effects)
return compileable_specialization(et, linfo, effects)
function compileable_specialization(et::Union{EdgeTracker, Nothing}, result::InferenceResult, effects::Effects)
return compileable_specialization(et, result.linfo, effects)
end

function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
Expand Down Expand Up @@ -1283,7 +1283,11 @@ function handle_const_call!(
any_fully_covered |= match.fully_covers
if isa(result, ConcreteResult)
case = concrete_result_item(result, state)
push!(cases, InliningCase(result.mi.specTypes, case))
if case === nothing
handled_all_cases = false
else
push!(cases, InliningCase(result.mi.specTypes, case))
end
elseif isa(result, ConstPropResult)
handled_all_cases &= handle_const_prop_result!(result, argtypes, flag, state, cases, true)
else
Expand Down

0 comments on commit 08a9c12

Please sign in to comment.