Skip to content

Commit

Permalink
Fix non data type (#2245)
Browse files Browse the repository at this point in the history
* Fix non data type

* fix

* Update compiler.jl
  • Loading branch information
wsmoses authored Jan 1, 2025
1 parent 1b19f39 commit a284eca
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ function zero_single_allocation(builder::LLVM.IRBuilder, @nospecialize(jlType::D
T_prjlvalue = LLVM.PointerType(T_jlvalue, Tracked)
T_prjlvalue_UT = LLVM.PointerType(T_jlvalue)

todo = Tuple{Vector{LLVM.Value},LLVM.LLVMType,DataType}[(
todo = Tuple{Vector{LLVM.Value},LLVM.LLVMType,Type}[(
LLVM.Value[idx],
LLVMType,
jlType,
Expand Down Expand Up @@ -803,14 +803,24 @@ function zero_single_allocation(builder::LLVM.IRBuilder, @nospecialize(jlType::D
continue
end
if isa(ty, LLVM.ArrayType)
subTy = if jlty isa DataType
eltype(jlty)
elseif !(jlty isa DataType)
if eltype(ty) isa LLVM.PointerType && LLVM.addrspace(eltype(ty)) == 10
Any
else
throw(AssertionError("jlty=$jlty ty=$ty"))
end
end
for i = 1:length(ty)
npath = copy(path)
push!(npath, LLVM.ConstantInt(LLVM.IntType(32), i - 1))
push!(todo, (npath, eltype(ty), eltype(jlty)))
push!(todo, (npath, eltype(ty), subTy))
end
continue
end
if isa(ty, LLVM.VectorType)
@assert jlty isa DataType
for i = 1:size(ty)
npath = copy(path)
push!(npath, LLVM.ConstantInt(LLVM.IntType(32), i - 1))
Expand All @@ -820,6 +830,7 @@ function zero_single_allocation(builder::LLVM.IRBuilder, @nospecialize(jlType::D
end
if isa(ty, LLVM.StructType)
i = 1
@assert jlty isa DataType
for ii = 1:fieldcount(jlty)
jlet = typed_fieldtype(jlty, ii)
if isghostty(jlet) || Core.Compiler.isconstType(jlet)
Expand Down

0 comments on commit a284eca

Please sign in to comment.