diff --git a/src/codegen.cpp b/src/codegen.cpp index 83fcf690215f7..84a726a421bad 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5631,6 +5631,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String unsigned argno = 1; #if JL_LLVM_VERSION < 120000 attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::StructRet); + (void)srt; // silence unused variable error #else Attribute sret = Attribute::getWithStructRetType(jl_LLVMContext, srt); attributes = attributes.addAttribute(jl_LLVMContext, argno, sret); @@ -5668,6 +5669,11 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String else if (isboxed && jl_is_immutable_datatype(jt)) { attributes = attributes.addParamAttribute(jl_LLVMContext, argno, Attribute::ReadOnly); } + else if (jl_is_primitivetype(jt) && ty->isIntegerTy()) { + bool issigned = jl_signed_type && jl_subtype(jt, (jl_value_t*)jl_signed_type); + Attribute::AttrKind attr = issigned ? Attribute::SExt : Attribute::ZExt; + attributes = attributes.addParamAttribute(jl_LLVMContext, argno, attr); + } fsig.push_back(ty); }