Skip to content

codegen: improve our argument annotations #35463

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

Merged
merged 1 commit into from
Apr 18, 2020
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ void addOptimizationPasses(legacy::PassManagerBase *PM, int opt_level,
PM->add(createLowerSimdLoopPass()); // Annotate loop marked with "loopinfo" as LLVM parallel loop
PM->add(createLICMPass());
PM->add(createLoopUnswitchPass());
PM->add(createLICMPass());
// Subsequent passes not stripping metadata from terminator
PM->add(createInstSimplifyLegacyPass());
PM->add(createIndVarSimplifyPass());
Expand Down
8 changes: 7 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4997,7 +4997,8 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String
jl_value_t *jt = jl_tparam(sig, i);
if (is_uniquerep_Type(jt))
continue;
Type *ty = deserves_argbox(jt) ? T_prjlvalue : julia_type_to_llvm(ctx, jt);
bool isboxed = deserves_argbox(jt);
Type *ty = isboxed ? T_prjlvalue : julia_type_to_llvm(ctx, jt);
if (type_is_ghost(ty))
continue;
unsigned argno = fsig.size();
Expand All @@ -5006,6 +5007,9 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String
attributes = attributes.addParamAttribute(jl_LLVMContext, argno, Attribute::ReadOnly);
ty = PointerType::get(ty, AddressSpace::Derived);
}
else if (isboxed && jl_is_immutable_datatype(jt)) {
attributes = attributes.addParamAttribute(jl_LLVMContext, argno, Attribute::ReadOnly);
}
fsig.push_back(ty);
}

Expand Down Expand Up @@ -5581,6 +5585,8 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
if (isboxed) // e.g. is-pointer
maybe_mark_argument_dereferenceable(Arg, argType);
theArg = mark_julia_type(ctx, Arg, isboxed, argType);
if (theArg.tbaa == tbaa_immut)
theArg.tbaa = tbaa_const;
}
return theArg;
};
Expand Down