@@ -1249,7 +1249,13 @@ function const_prop_call(interp::AbstractInterpreter,
12491249 inf_cache = get_inference_cache (interp)
12501250 πα΅’ = typeinf_lattice (interp)
12511251 argtypes = has_conditional (πα΅’, sv) ? ConditionalArgtypes (arginfo, sv) : SimpleArgtypes (arginfo. argtypes)
1252- given_argtypes, overridden_by_const = matching_cache_argtypes (πα΅’, mi, argtypes, result. volatile_inf_result)
1252+ volatile_inf_result = result. volatile_inf_result
1253+ if volatile_inf_result != = nothing
1254+ cache_argtypes = volatile_inf_result. inf_result. argtypes
1255+ else
1256+ cache_argtypes = matching_cache_argtypes (πα΅’, mi)
1257+ end
1258+ given_argtypes = matching_cache_argtypes (πα΅’, mi, argtypes, cache_argtypes)
12531259 inf_result = cache_lookup (πα΅’, mi, given_argtypes, inf_cache)
12541260 if inf_result != = nothing
12551261 # found the cache for this constant prop'
@@ -1260,6 +1266,12 @@ function const_prop_call(interp::AbstractInterpreter,
12601266 @assert inf_result. linfo === mi " MethodInstance for cached inference result does not match"
12611267 return return_cached_result (interp, inf_result, sv)
12621268 end
1269+ overridden_by_const = falses (length (given_argtypes))
1270+ for i = 1 : length (given_argtypes)
1271+ if given_argtypes[i] != = cache_argtypes[i]
1272+ overridden_by_const[i] = true
1273+ end
1274+ end
12631275 if ! any (overridden_by_const)
12641276 add_remark! (interp, sv, " [constprop] Could not handle constant info in matching_cache_argtypes" )
12651277 return nothing
@@ -1301,17 +1313,12 @@ as well as the other general extended lattice information.
13011313"""
13021314function matching_cache_argtypes (π:: AbstractLattice , mi:: MethodInstance ,
13031315 conditional_argtypes:: ConditionalArgtypes ,
1304- volatile_inf_result :: Union{Nothing,VolatileInferenceResult} = nothing )
1316+ cache_argtypes :: Vector{Any} )
13051317 (; arginfo, sv) = conditional_argtypes
13061318 (; fargs, argtypes) = arginfo
13071319 given_argtypes = Vector {Any} (undef, length (argtypes))
13081320 def = mi. def:: Method
13091321 nargs = Int (def. nargs)
1310- if volatile_inf_result != = nothing
1311- cache_argtypes = volatile_inf_result. inf_result. argtypes
1312- else
1313- cache_argtypes = matching_cache_argtypes (π, mi)
1314- end
13151322 local condargs = nothing
13161323 for i in 1 : length (argtypes)
13171324 argtype = argtypes[i]
@@ -1354,7 +1361,7 @@ function matching_cache_argtypes(π::AbstractLattice, mi::MethodInstance,
13541361 else
13551362 given_argtypes = va_process_argtypes (π, given_argtypes, mi)
13561363 end
1357- return pick_const_args (π, given_argtypes, cache_argtypes)
1364+ return pick_const_args! (π, given_argtypes, cache_argtypes)
13581365end
13591366
13601367# This is only for use with `Conditional`.
0 commit comments