@@ -88,11 +88,7 @@ function irgen(@nospecialize(job::CompilerJob))
8888 for arg in args
8989 if arg. cc == BITS_REF
9090 llvm_typ = convert (LLVMType, arg. typ)
91- attr = @static if LLVM. version () >= v " 12"
92- TypeAttribute (" byval" , llvm_typ)
93- else
94- EnumAttribute (" byval" , 0 )
95- end
91+ attr = TypeAttribute (" byval" , llvm_typ)
9692 push! (parameter_attributes (entry, arg. idx), attr)
9793 end
9894 end
@@ -381,17 +377,10 @@ function lower_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, f::LLVM.
381377
382378 # find the byval parameters
383379 byval = BitVector (undef, length (parameters (ft)))
384- if LLVM. version () >= v " 12"
385- for i in 1 : length (byval)
386- attrs = collect (parameter_attributes (f, i))
387- byval[i] = any (attrs) do attr
388- kind (attr) == kind (EnumAttribute (" byval" , 0 ))
389- end
390- end
391- else
392- # XXX : byval is not round-trippable on LLVM < 12 (see maleadt/LLVM.jl#186)
393- for arg in args
394- byval[arg. idx] = (arg. cc == BITS_REF)
380+ for i in 1 : length (byval)
381+ attrs = collect (parameter_attributes (f, i))
382+ byval[i] = any (attrs) do attr
383+ kind (attr) == kind (TypeAttribute (" byval" , LLVM. VoidType ()))
395384 end
396385 end
397386
0 commit comments