Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Oct 30, 2024
1 parent 511ad50 commit 11a6bba
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/absint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ function actual_size(@nospecialize(typ2))
return sizeof(Int)
end
else
if typ2 <: GenericMemory
return sizeof(Int)
end
end
if typ2 <: AbstractString || typ2 <: Symbol
return sizeof(Int)
Expand Down Expand Up @@ -436,9 +439,37 @@ function abs_typeof(
end

if isa(arg, LLVM.LoadInst)


legal = false
typ = nothing
byref = GPUCompiler.BITS_VALUE

if isa(operands(arg)[1], LLVM.ConstantExpr)
ce = operands(arg)[1]
while isa(ce, ConstantExpr)
if opcode(ce) == LLVM.API.LLVMAddrSpaceCast ||
opcode(ce) == LLVM.API.LLVMBitCast ||
opcode(ce) == LLVM.API.LLVMIntToPtr
ce = operands(ce)[1]
else
break
end
end
if isa(ce, LLVM.ConstantInt)
ptr = unsafe_load(reinterpret(Ptr{Ptr{Cvoid}}, convert(UInt, ce)))
if ptr != C_NULL
obj = Base.unsafe_pointer_to_objref(ptr)
return (true, Core.Typeof(obj), GPUCompiler.BITS_REF)
end
end
end

larg, offset = get_base_and_offset(operands(arg)[1])
if !legal
legal, typ, byref = abs_typeof(larg)
end

legal, typ, byref = abs_typeof(larg)
if legal && (byref == GPUCompiler.MUT_REF || byref == GPUCompiler.BITS_REF) && Base.isconcretetype(typ)
@static if VERSION < v"1.11-"
if typ <: Array && Base.isconcretetype(typ)
Expand Down

0 comments on commit 11a6bba

Please sign in to comment.