Skip to content

Commit 3956789

Browse files
committed
Use byval with type on LLVM 12.
1 parent 6946763 commit 3956789

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/interface.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ function process_entry!(@nospecialize(job::CompilerJob), mod::LLVM.Module,
176176
args = classify_arguments(job, entry)
177177
for arg in args
178178
if arg.cc == BITS_REF
179-
push!(parameter_attributes(entry, arg.codegen.i), EnumAttribute("byval", 0; ctx))
179+
attr = if LLVM.version() >= v"12"
180+
TypeAttribute("byval", eltype(arg.codegen.typ); ctx)
181+
else
182+
EnumAttribute("byval", 0; ctx)
183+
end
184+
push!(parameter_attributes(entry, arg.codegen.i), attr)
180185
end
181186
end
182187
end

src/spirv.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ function wrap_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, entry_f::
185185
param = parameters(wrapper_f)[arg.codegen.i]
186186
attrs = parameter_attributes(wrapper_f, arg.codegen.i)
187187
if arg.cc == BITS_REF
188-
push!(attrs, EnumAttribute("byval", 0; ctx))
188+
if LLVM.version() >= v"12"
189+
push!(attrs, TypeAttribute("byval", eltype(arg.codegen.typ); ctx))
190+
else
191+
push!(attrs, EnumAttribute("byval", 0; ctx))
192+
end
189193
ptr = struct_gep!(builder, param, 0)
190194
push!(wrapper_args, ptr)
191195
else

0 commit comments

Comments
 (0)