Skip to content

Commit 34ab0a9

Browse files
authored
Merge pull request #39051 from JuliaLang/vc/sext
Annotate function arguments with sext/zext
2 parents 66c9f6a + 0949eb2 commit 34ab0a9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/codegen.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5628,6 +5628,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String
56285628
unsigned argno = 1;
56295629
#if JL_LLVM_VERSION < 120000
56305630
attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::StructRet);
5631+
(void)srt; // silence unused variable error
56315632
#else
56325633
Attribute sret = Attribute::getWithStructRetType(jl_LLVMContext, srt);
56335634
attributes = attributes.addAttribute(jl_LLVMContext, argno, sret);
@@ -5665,6 +5666,11 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String
56655666
else if (isboxed && jl_is_immutable_datatype(jt)) {
56665667
attributes = attributes.addParamAttribute(jl_LLVMContext, argno, Attribute::ReadOnly);
56675668
}
5669+
else if (jl_is_primitivetype(jt) && ty->isIntegerTy()) {
5670+
bool issigned = jl_signed_type && jl_subtype(jt, (jl_value_t*)jl_signed_type);
5671+
Attribute::AttrKind attr = issigned ? Attribute::SExt : Attribute::ZExt;
5672+
attributes = attributes.addParamAttribute(jl_LLVMContext, argno, attr);
5673+
}
56685674
fsig.push_back(ty);
56695675
}
56705676

0 commit comments

Comments
 (0)