@@ -725,7 +725,7 @@ function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
725725 (; match) = todo. spec:: DelayedInliningSpec
726726
727727 # XXX : update_valid_age!(min_valid[1], max_valid[1], sv)
728- isconst, src, argtypes = false , nothing , nothing
728+ isconst, src = false , nothing
729729 if isa (match, InferenceResult)
730730 let inferred_src = match. src
731731 if isa (inferred_src, Const)
@@ -737,9 +737,6 @@ function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
737737 isconst, src = false , inferred_src
738738 end
739739 end
740- if is_stmt_inline (flag)
741- argtypes = match. argtypes
742- end
743740 else
744741 linfo = get (state. mi_cache, todo. mi, nothing )
745742 if linfo isa CodeInstance
@@ -752,9 +749,6 @@ function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
752749 else
753750 isconst, src = false , linfo
754751 end
755- if is_stmt_inline (flag)
756- argtypes = collect (todo. mi. specTypes. parameters):: Vector{Any}
757- end
758752 end
759753
760754 et = state. et
@@ -764,18 +758,7 @@ function resolve_todo(todo::InliningTodo, state::InliningState, flag::UInt8)
764758 return ConstantCase (src)
765759 end
766760
767- if argtypes != = nothing && src === nothing
768- inf_cache = state. inf_cache
769- inf_result = cache_lookup (todo. mi, argtypes, inf_cache)
770- if isa (inf_result, InferenceResult)
771- src = inf_result. src
772- if isa (src, OptimizationState)
773- src = src. src
774- end
775- end
776- end
777-
778- src = state. policy (src, flag, match)
761+ src = inlining_policy (state. interp, src, flag, match)
779762
780763 if src === nothing
781764 return compileable_specialization (et, match)
@@ -1420,7 +1403,8 @@ end
14201403function late_inline_special_case! (ir:: IRCode , sig:: Signature , idx:: Int , stmt:: Expr , params:: OptimizationParams )
14211404 f, ft, atypes = sig. f, sig. ft, sig. atypes
14221405 typ = ir. stmts[idx][:type ]
1423- if params. inlining && length (atypes) == 3 && istopfunction (f, :!= = )
1406+ isinlining = params. inlining
1407+ if isinlining && length (atypes) == 3 && istopfunction (f, :!= = )
14241408 # special-case inliner for !== that precedes _methods_by_ftype union splitting
14251409 # and that works, even though inference generally avoids inferring the `!==` Method
14261410 if isa (typ, Const)
@@ -1432,7 +1416,7 @@ function late_inline_special_case!(ir::IRCode, sig::Signature, idx::Int, stmt::E
14321416 not_call = Expr (:call , GlobalRef (Core. Intrinsics, :not_int ), cmp_call_ssa)
14331417 ir[SSAValue (idx)] = not_call
14341418 return true
1435- elseif params . inlining && length (atypes) == 3 && istopfunction (f, :(> :))
1419+ elseif isinlining && length (atypes) == 3 && istopfunction (f, :(> :))
14361420 # special-case inliner for issupertype
14371421 # that works, even though inference generally avoids inferring the `>:` Method
14381422 if isa (typ, Const) && _builtin_nothrow (< :, Any[atypes[3 ], atypes[2 ]], typ)
@@ -1442,7 +1426,7 @@ function late_inline_special_case!(ir::IRCode, sig::Signature, idx::Int, stmt::E
14421426 subtype_call = Expr (:call , GlobalRef (Core, :(< :)), stmt. args[3 ], stmt. args[2 ])
14431427 ir[SSAValue (idx)] = subtype_call
14441428 return true
1445- elseif params . inlining && f === TypeVar && 2 <= length (atypes) <= 4 && (atypes[2 ] ⊑ Symbol)
1429+ elseif isinlining && f === TypeVar && 2 <= length (atypes) <= 4 && (atypes[2 ] ⊑ Symbol)
14461430 ir[SSAValue (idx)] = Expr (:call , GlobalRef (Core, :_typevar ), stmt. args[2 ],
14471431 length (stmt. args) < 4 ? Bottom : stmt. args[3 ],
14481432 length (stmt. args) == 2 ? Any : stmt. args[end ])
0 commit comments