Skip to content

Commit 66ca19e

Browse files
committed
[Metal] fix code_llvm(...; optimize=false)
1 parent 43dd410 commit 66ca19e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/metal.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function add_parameter_address_spaces!(@nospecialize(job::CompilerJob), mod::LLV
238238

239239
# find the byref parameters
240240
byref = BitVector(undef, length(parameters(ft)))
241-
args = classify_arguments(job, ft; post_optimization=true)
241+
args = classify_arguments(job, ft; post_optimization=job.config.optimize)
242242
filter!(args) do arg
243243
arg.cc != GHOST
244244
end
@@ -563,11 +563,15 @@ function add_argument_metadata!(@nospecialize(job::CompilerJob), mod::LLVM.Modul
563563
arg_infos = Metadata[]
564564

565565
# Iterate through arguments and create metadata for them
566-
args = classify_arguments(job, entry_ft; post_optimization=true)
566+
args = classify_arguments(job, entry_ft; post_optimization=job.config.optimize)
567567
i = 1
568568
for arg in args
569569
arg.idx === nothing && continue
570-
@assert parameters(entry_ft)[arg.idx] isa LLVM.PointerType
570+
if job.config.optimize
571+
@assert parameters(entry_ft)[arg.idx] isa LLVM.PointerType
572+
else
573+
parameters(entry_ft)[arg.idx] isa LLVM.PointerType || continue
574+
end
571575

572576
# NOTE: we emit the bare minimum of argument metadata to support
573577
# bindless argument encoding. Actually using the argument encoder

0 commit comments

Comments
 (0)