Skip to content

Commit

Permalink
Merge pull request #39051 from JuliaLang/vc/sext
Browse files Browse the repository at this point in the history
Annotate function arguments with sext/zext
  • Loading branch information
vchuravy authored Jan 7, 2021
2 parents 66c9f6a + 0949eb2 commit 34ab0a9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5628,6 +5628,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);
Expand Down Expand Up @@ -5665,6 +5666,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);
}

Expand Down

0 comments on commit 34ab0a9

Please sign in to comment.