Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate function arguments with sext/zext #39051

Merged
merged 2 commits into from
Jan 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down