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

Unify invoke/new/call path #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
11 changes: 3 additions & 8 deletions src/codegen/forward_demand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,11 @@ function forward_diff_no_inf!(ir::IRCode, to_diff::Vector{Pair{SSAValue,Int}};
else
inst = ir[SSAValue(ssa)]
stmt = inst[:inst]
if isexpr(stmt, :invoke)
newargs = map(stmt.args[2:end]) do @nospecialize arg
if isexpr(stmt, :invoke) || isexpr(stmt, :call) || isexpr(stmt, :new)
newargs = map(@view stmt.args[isexpr(stmt, :invoke) + 1:end]) do @nospecialize arg
maparg(arg, SSAValue(ssa), order)
end
replace_call!(ir, SSAValue(ssa), Expr(:call, ∂☆{order}(), newargs...))
elseif isexpr(stmt, :call) || isexpr(stmt, :new)
newargs = map(stmt.args) do @nospecialize arg
maparg(arg, SSAValue(ssa), order)
end
f = isexpr(stmt, :call) ? ∂☆{order}() : ∂☆new{order}()
f = isexpr(stmt, :new) ? ∂☆new{order}() : ∂☆{order}()
replace_call!(ir, SSAValue(ssa), Expr(:call, f, newargs...))
elseif isa(stmt, PiNode)
# TODO: New PiNode that discriminates based on primal?
Expand Down
Loading