diff --git a/src/compiler/optimize.jl b/src/compiler/optimize.jl index 0afc3606a27..4c0d2f65235 100644 --- a/src/compiler/optimize.jl +++ b/src/compiler/optimize.jl @@ -723,6 +723,10 @@ function propagate_returned!(mod::LLVM.Module) push!(todo, un) end for un in todo + md = metadata(un) + if !keepret && haskey(md, LLVM.MD_range) + delete!(md, LLVM.MD_range) + end API.EnzymeSetCalledFunction(un, nfn, toremove) end unsafe_delete!(mod, fn)