Skip to content

Commit

Permalink
Fix custom rule with batch fwd pointer (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Sep 26, 2023
1 parent a957410 commit ebf8534
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4642,7 +4642,14 @@ function enzyme_custom_common_rev(forward::Bool, B, orig::LLVM.CallInst, gutils,
shadowV = extract_value!(B, res, idx)
if get_return_info(RealRt)[2] !== nothing
dval = invert_pointer(gutils, operands(orig)[1], B)
store!(B, shadowV, dval)

for idx in 1:width
to_store = (width == 1) ? shadowV : extract_value!(B, shadowV, idx-1)

store_ptr = (width == 1) ? dval : extract_value!(B, dval, idx-1)

store!(B, to_store, store_ptr)
end
shadowV = C_NULL
else
@assert value_type(shadowV) == shadowType
Expand Down

0 comments on commit ebf8534

Please sign in to comment.