Skip to content

Commit 98740e3

Browse files
authored
Custom rule tape fixup (#2816)
1 parent 7886a73 commit 98740e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rules/customrules.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,12 @@ function enzyme_custom_common_rev(
15161516
tapeV = tapeV.ref
15171517
end
15181518
elseif tape isa LLVM.Value && length(byval_tapes) != 0
1519-
tape = extract_value!(B, tape, length(byval_tapes))
1519+
if needsTape
1520+
@assert length(LLVM.elements(value_type(tape))) == length(byval_tapes) + 1
1521+
tape = extract_value!(B, tape, length(byval_tapes))
1522+
else
1523+
tape = nothing
1524+
end
15201525
end
15211526

15221527
# if !forward

0 commit comments

Comments
 (0)