Skip to content

Commit dac277c

Browse files
authored
Metal: support the lifetime intrinsics. (#338)
1 parent 699b393 commit dac277c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/metal.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,17 @@ function add_address_spaces!(mod::LLVM.Module, f::LLVM.Function)
214214
isoverloaded(intr) || continue
215215

216216
# get an appropriately-overloaded intrinsic instantiation
217-
# XXX: apparently it differs per intrinsics which arguments to take into
218-
# consideration when generating an overload? for example, with memcpy
219-
# the trailing i1 argument is not included in the overloaded name.
217+
# NOTE: the overload types differs from the argument types
220218
intr_f = if intr == Intrinsic("llvm.memcpy")
221219
LLVM.Function(mod, intr, llvmtype.(arguments(inst)[1:end-1]))
220+
elseif intr == Intrinsic("llvm.lifetime.start") ||
221+
intr == Intrinsic("llvm.lifetime.end")
222+
LLVM.Function(mod, intr, [llvmtype(arguments(inst)[end])])
222223
else
223-
error("Unsupported intrinsic; please file an issue.")
224+
# TODO: use matchIntrinsicSignature to do this generically
225+
error("""Unsupported intrinsic call:
226+
$inst.
227+
Please file an issue with at https://github.com/JuliaGPU/GPUCompiler.jl""")
224228
end
225229

226230
# create a call to the new intrinsic

0 commit comments

Comments
 (0)