@@ -355,20 +355,22 @@ function statement_cost(ex::Expr, line::Int, src::Union{CodeInfo, IRCode}, sptyp
355355 # tuple iteration/destructuring makes that impossible
356356 # return plus_saturate(argcost, isknowntype(extyp) ? 1 : params.inline_nonleaf_penalty)
357357 return 0
358+ elseif (f === Core. arrayref || f === Core. const_arrayref || f === Core. arrayset) && length (ex. args) >= 3
359+ atyp = argextype (ex. args[3 ], src, sptypes, slottypes)
360+ return isknowntype (atyp) ? 4 : error_path ? params. inline_error_path_cost : params. inline_nonleaf_penalty
361+ elseif f === typeassert && isconstType (widenconst (argextype (ex. args[3 ], src, sptypes, slottypes)))
362+ return 1
358363 elseif f === Core. isa
359364 # If we're in a union context, we penalize type computations
360365 # on union types. In such cases, it is usually better to perform
361366 # union splitting on the outside.
362367 if union_penalties && isa (argextype (ex. args[2 ], src, sptypes, slottypes), Union)
363368 return params. inline_nonleaf_penalty
364369 end
365- elseif (f === Core. arrayref || f === Core. const_arrayref) && length (ex. args) >= 3
366- atyp = argextype (ex. args[3 ], src, sptypes, slottypes)
367- return isknowntype (atyp) ? 4 : error_path ? params. inline_error_path_cost : params. inline_nonleaf_penalty
368370 end
369371 fidx = find_tfunc (f)
370372 if fidx === nothing
371- # unknown/unhandled builtin or anonymous function
373+ # unknown/unhandled builtin
372374 # Use the generic cost of a direct function call
373375 return 20
374376 end
0 commit comments