Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NewOptimizer] Fix _apply elision #26821

Merged
merged 1 commit into from
Apr 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions base/compiler/ssair/inlining2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,22 @@ function maybe_make_invoke!(ir::IRCode, idx::Int, @nospecialize(etype), atypes::
@nospecialize(atype_unlimited), isinvoke::Bool, isapply::Bool, @nospecialize(invoke_data))
nu = countunionsplit(atypes)
nu > 1 && return # TODO: The old optimizer did union splitting here. Is this the right place?
ex = Expr(:invoke)
linfo = spec_lambda(atype_unlimited, sv, invoke_data)
linfo === nothing && return
add_backedge!(linfo, sv)
if linfo === nothing
if !isapply || isinvoke
return
end
# We might not have an linfo, but we can still rewrite the _apply into a regular call
# based on our analysis
ex = Expr(:call)
else
ex = Expr(:invoke)
add_backedge!(linfo, sv)
end
argexprs = ir[SSAValue(idx)].args
argexprs = rewrite_exprargs((node, typ)->insert_node!(ir, idx, typ, node), arg->exprtype(arg, ir, ir.mod),
isinvoke, isapply, argexprs)
pushfirst!(argexprs, linfo)
linfo !== nothing && pushfirst!(argexprs, linfo)
ex.typ = etype
ex.args = argexprs
ir[SSAValue(idx)] = ex
Expand Down Expand Up @@ -466,7 +474,6 @@ function assemble_inline_todo!(ir::IRCode, linetable::Vector{LineInfoNode}, sv::
methsp = methsp::SimpleVector
end


methsig = method.sig
if !(atype <: metharg)
maybe_make_invoke!(ir, idx, stmt.typ, atypes, sv, atype_unlimited, isinvoke, isapply, invoke_data)
Expand Down