From af749d0b9b0eab5b571076d8f6e9e1d7224904c1 Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Tue, 3 Dec 2024 19:42:23 -0600 Subject: [PATCH] Only mark writeonly if pointer abi --- src/llvm/attributes.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/llvm/attributes.jl b/src/llvm/attributes.jl index 3dd5973421..06a8bce108 100644 --- a/src/llvm/attributes.jl +++ b/src/llvm/attributes.jl @@ -831,8 +831,10 @@ function annotate!(mod::LLVM.Module) for fn in funcs[fname] push!(parameter_attributes(fn, 2), LLVM.StringAttribute("enzyme_inactive")) push!(parameter_attributes(fn, 4), LLVM.StringAttribute("enzyme_inactive")) - push!(parameter_attributes(fn, 4), LLVM.EnumAttribute("writeonly")) - push!(parameter_attributes(fn, 4), LLVM.EnumAttribute("nocapture")) + if value_type(LLVM.parameters(fn, 4)) isa LLVM.PointerType + push!(parameter_attributes(fn, 4), LLVM.EnumAttribute("writeonly")) + push!(parameter_attributes(fn, 4), LLVM.EnumAttribute("nocapture")) + end if LLVM.version().major <= 15 push!(function_attributes(fn), LLVM.EnumAttribute("argmemonly")) else