Skip to content

Commit

Permalink
Fix array type cast (#1050)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Sep 12, 2023
1 parent 6d8d716 commit f06c452
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8024,6 +8024,29 @@ function create_abi_wrapper(enzymefn::LLVM.Function, TT, rettype, actualRetType,
end
return prev
end
elseif isa(tape, LLVM.ArrayType)
if isa(ctype, LLVM.ArrayType)
@assert length(ctype) == length(tape)
for i in 1:length(tape)
ln = copy(lidxs)
push!(ln, i-1)
rn = copy(ridxs)
push!(rn, i-1)
prev = typefix(val, eltype(tape), prev, ln, rn)
end
return prev
end
if isa(ctype, LLVM.StructType)
@assert length(elements(ctype)) == length(tape)
for i in 1:length(tape)
ln = copy(lidxs)
push!(ln, i-1)
rn = copy(ridxs)
push!(rn, i-1)
prev = typefix(val, eltype(tape), prev, ln, rn)
end
return prev
end
end

if isa(tape, LLVM.IntegerType) && LLVM.width(tape) == 1 && LLVM.width(ctype) != LLVM.width(tape)
Expand Down

0 comments on commit f06c452

Please sign in to comment.