Skip to content

Commit 3d86564

Browse files
committed
Slightly better forward of _apply_call
1 parent 9045899 commit 3d86564

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/analysis/forward.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ function fwd_abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize
1212
return primal_call
1313
end
1414

15+
if f === Core._apply_iterate
16+
@assert !isready(primal_call) || !isa(primal_call[].info, FRuleCallInfo)
17+
# For performance and to avoid inlining getting confused about the lack
18+
# of UnionSplitApplyCallInfo, special case apply to skip the frule check.
19+
# Note that the we still check the frule of the actually applied function.
20+
return primal_call
21+
end
22+
1523
nargs = length(arginfo.argtypes)-1
1624
frule_preargtypes = Any[Const(ChainRulesCore.frule), Tuple{Nothing,Vararg{Any,nargs}}]
1725
frule_argtypes = append!(frule_preargtypes, arginfo.argtypes)
@@ -20,11 +28,6 @@ function fwd_abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize
2028
local frule_call::Future{CallMeta}
2129
local result::Future{CallMeta} = Future{CallMeta}()
2230
function make_progress(_, sv)
23-
if isa(primal_call[].info, UnionSplitApplyCallInfo)
24-
result[] = primal_call[]
25-
return true
26-
end
27-
2831
ready = false
2932
if !@isdefined(frule_call)
3033
# Here we simply check for the frule existance - we don't want to do a full

0 commit comments

Comments
 (0)