Skip to content

Commit 75abbea

Browse files
authored
Metal: Avoid duplicate intrinsics. (#517)
1 parent 5fc8d91 commit 75abbea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/metal.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,11 @@ function lower_llvm_intrinsics!(@nospecialize(job::CompilerJob), fun::LLVM.Funct
898898
end
899899
fn *= "." * type_suffix(typ)
900900

901-
new_intr = LLVM.Function(mod, fn, call_ft)
901+
new_intr = if haskey(functions(mod), fn)
902+
functions(mod)[fn]
903+
else
904+
LLVM.Function(mod, fn, call_ft)
905+
end
902906
@dispose builder=IRBuilder() begin
903907
position!(builder, call)
904908
debuglocation!(builder, call)

0 commit comments

Comments
 (0)