Skip to content

Commit

Permalink
don't require varargs to be in last position to exploit cached type info
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed May 4, 2018
1 parent 6e78ef1 commit 6106b90
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions base/compiler/ssair/inlining2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -576,18 +576,7 @@ function analyze_method!(idx, f, ft, metharg, methsp, method, stmt, atypes, sv,
return ConstantCase(quoted(linfo.inferred_const), method, Any[methsp...], metharg)
end

# Handle vararg functions
prevararg_rewritten_atypes = atypes
isva = na > 0 && method.isva
if isva
@assert length(atypes) >= na - 1
va_type = tuple_tfunc(Tuple{Any[widenconst(atypes[i]) for i in 1:length(atypes)]...})
atypes = Any[atypes[1:(na - 1)]..., va_type]
end

# Go see if we already have a pre-inferred result. Use prevararg_rewritten_atypes
# for the lookup, since that's what inference used when it populated the cache.
res = find_inferred(linfo, prevararg_rewritten_atypes, sv)
res = find_inferred(linfo, atypes, sv)
res === nothing && return nothing

if length(res::Tuple) == 1
Expand Down

0 comments on commit 6106b90

Please sign in to comment.