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

Add src alignment arg to emit_memcpy #51152

Merged
merged 9 commits into from
Sep 27, 2023
Merged

Add src alignment arg to emit_memcpy #51152

merged 9 commits into from
Sep 27, 2023

Conversation

gbaraldi
Copy link
Member

@gbaraldi gbaraldi commented Sep 1, 2023

This maybe allows for LLVM to optimize things a bit further since some passes check if both sides have correct/equal alignment

@gbaraldi gbaraldi requested a review from vtjnash September 1, 2023 18:19
Comment on lines 552 to +554
Value *slot = emit_static_alloca(ctx, to);
unsigned align = julia_alignment(jlto);
cast<AllocaInst>(slot)->setAlignment(Align(align));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make this an argument, since it is pretty much required now by AllocaInst (it will attempt a bad guess if you don't provide it https://llvm.org/doxygen/Instructions_8cpp.html#a35edfaf69cb59d25d92b1e77f0c27530)

src/cgutils.cpp Outdated Show resolved Hide resolved
src/codegen.cpp Outdated Show resolved Hide resolved
src/cgutils.cpp Outdated
@@ -3110,7 +3110,7 @@ static void init_bits_cgval(jl_codectx_t &ctx, Value *newv, const jl_cgval_t& v,
{
// newv should already be tagged
if (v.ispointer()) {
emit_memcpy(ctx, newv, jl_aliasinfo_t::fromTBAA(ctx, tbaa), v, jl_datatype_size(v.typ), sizeof(void*));
emit_memcpy(ctx, newv, jl_aliasinfo_t::fromTBAA(ctx, tbaa), v, jl_datatype_size(v.typ), sizeof(void*), sizeof(void*));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newv was a jl_value_t*, so it had heap-alignment, but v is not, so it has julia_alignment

src/codegen.cpp Outdated Show resolved Hide resolved
src/codegen.cpp Outdated Show resolved Hide resolved
src/codegen.cpp Outdated Show resolved Hide resolved
src/intrinsics.cpp Outdated Show resolved Hide resolved
src/intrinsics.cpp Outdated Show resolved Hide resolved
src/intrinsics.cpp Outdated Show resolved Hide resolved
@brenhinkeller brenhinkeller added the compiler:llvm For issues that relate to LLVM label Sep 2, 2023
@gbaraldi
Copy link
Member Author

bump!

@vtjnash vtjnash merged commit 5e8f8a9 into master Sep 27, 2023
@vtjnash vtjnash deleted the gb/more-align branch September 27, 2023 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:llvm For issues that relate to LLVM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants