Skip to content

Commit 35cde4c

Browse files
committed
Implement ir.argtypes[1] fix from JuliaLang/julia#54458
1 parent 48d764d commit 35cde4c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/stage2/forward.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function dontuse_nth_order_forward_stage2(tt::Type, order::Int=1; eras_mode = fa
8282
end
8383

8484
ir = forward_diff!(interp, ir, src, mi, vals; visit_custom!, transform!, eras_mode)
85+
ir.argtypes[1] = Tuple{}
8586

8687
return OpaqueClosure(ir)
8788
end

test/forward_diff_no_inf.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ module forward_diff_no_inf
8383
ir = first(only(Base.code_ircode(foo_148, Tuple{Float64})))
8484
Diffractor.forward_diff_no_inf!(ir, [SSAValue(1) => 1]; transform! = identity_transform!)
8585
ir2 = CC.compact!(ir)
86+
ir2.argtypes[1] = Tuple{}
8687
f = Core.OpaqueClosure(ir2; do_compile=false)
8788
@test f(1.0) == Bar148(1.0) # This would error if we were not handling constructors (%new) right
8889
end
@@ -100,6 +101,7 @@ module forward_diff_no_inf
100101
stmt = ir2.stmts[stmt_idx]
101102
@test stmt[:inst].name == :_coeff
102103
@test stmt[:type] == Float64
104+
ir2.argtypes[1] = Tuple{}
103105
f = Core.OpaqueClosure(ir2; do_compile=false)
104106
@test f(3.5) == 28.0
105107
end
@@ -128,6 +130,7 @@ module forward_diff_no_inf
128130
Diffractor.forward_diff_no_inf!(ir, diff_ssa .=> 1; transform! = identity_transform!)
129131
ir2 = CC.compact!(ir)
130132
CC.verify_ir(ir2) # This would error if we were not handling nonconst phi nodes correctly (after https://github.com/JuliaLang/julia/pull/50158)
133+
ir2.argtypes[1] = Tuple{}
131134
f = Core.OpaqueClosure(ir2; do_compile=false)
132135
@test f(3.5) == 3.5 # this will segfault if we are not handling phi nodes correctly
133136
end
@@ -158,4 +161,3 @@ module forward_diff_no_inf
158161
end
159162
end
160163
end # module
161-

0 commit comments

Comments
 (0)