Skip to content

Commit d33a71e

Browse files
committed
compiler: fix specialization mistake introduced by #40985
1 parent 20b5455 commit d33a71e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

base/compiler/ssair/inlining.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,6 @@ function analyze_method!(match::MethodMatch, argtypes::Vector{Any},
937937
allow_typevars::Bool, invokesig::Union{Nothing,Vector{Any}}=nothing,
938938
volatile_inf_result::Union{Nothing,VolatileInferenceResult}=nothing)
939939
method = match.method
940-
spec_types = match.spec_types
941940

942941
# Check that we have the correct number of arguments
943942
na = Int(method.nargs)
@@ -952,6 +951,7 @@ function analyze_method!(match::MethodMatch, argtypes::Vector{Any},
952951
if !match.fully_covers
953952
# type-intersection was not able to give us a simple list of types, so
954953
# ir_inline_unionsplit won't be able to deal with inlining this
954+
spec_types = match.spec_types
955955
if !(spec_types isa DataType && length(spec_types.parameters) == npassedargs &&
956956
!isvarargtype(spec_types.parameters[end]))
957957
return nothing
@@ -1424,28 +1424,26 @@ function handle_match!(cases::Vector{InliningCase},
14241424
match::MethodMatch, argtypes::Vector{Any}, @nospecialize(info::CallInfo), flag::UInt32,
14251425
state::InliningState;
14261426
allow_typevars::Bool, volatile_inf_result::Union{Nothing,VolatileInferenceResult})
1427-
spec_types = match.spec_types
14281427
# We may see duplicated dispatch signatures here when a signature gets widened
14291428
# during abstract interpretation: for the purpose of inlining, we can just skip
14301429
# processing this dispatch candidate (unless unmatched type parameters are present)
1431-
!allow_typevars && any(case::InliningCase->case.sig === spec_types, cases) && return true
1430+
!allow_typevars && any(case::InliningCase->case.sig === match.spec_types, cases) && return true
14321431
item = analyze_method!(match, argtypes, info, flag, state; allow_typevars, volatile_inf_result)
14331432
item === nothing && return false
1434-
push!(cases, InliningCase(spec_types, item))
1433+
push!(cases, InliningCase(match.spec_types, item))
14351434
return true
14361435
end
14371436

14381437
function handle_const_prop_result!(cases::Vector{InliningCase}, result::ConstPropResult,
14391438
match::MethodMatch, @nospecialize(info::CallInfo), flag::UInt32, state::InliningState;
14401439
allow_typevars::Bool)
14411440
mi = result.result.linfo
1442-
spec_types = match.spec_types
14431441
if !validate_sparams(mi.sparam_vals)
14441442
(allow_typevars && !may_have_fcalls(mi.def::Method)) || return false
14451443
end
14461444
item = resolve_todo(mi, result.result, info, flag, state)
14471445
item === nothing && return false
1448-
push!(cases, InliningCase(spec_types, item))
1446+
push!(cases, InliningCase(match.spec_types, item))
14491447
return true
14501448
end
14511449

@@ -1473,11 +1471,10 @@ end
14731471
function handle_semi_concrete_result!(cases::Vector{InliningCase}, result::SemiConcreteResult,
14741472
match::MethodMatch, @nospecialize(info::CallInfo), flag::UInt32, state::InliningState)
14751473
mi = result.edge.def
1476-
spec_types = match.spec_types
14771474
validate_sparams(mi.sparam_vals) || return false
14781475
item = semiconcrete_result_item(result, info, flag, state)
14791476
item === nothing && return false
1480-
push!(cases, InliningCase(spec_types, item))
1477+
push!(cases, InliningCase(match.spec_types, item))
14811478
return true
14821479
end
14831480

0 commit comments

Comments
 (0)