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

Unable to achieve aligned writes #33923

Open
kirillkh opened this issue May 28, 2016 · 8 comments
Open

Unable to achieve aligned writes #33923

kirillkh opened this issue May 28, 2016 · 8 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. I-slow Issue: Problems and improvements with respect to performance of generated code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kirillkh
Copy link

kirillkh commented May 28, 2016

I am trying to implement an efficient memory move operation for a specific usage pattern: https://play.rust-lang.org/?gist=6ddd4e11d7f7b0f6503ddd398f0e665f&version=nightly&backtrace=1

In release mode, the loop in move_items() in the above example is compiled into a series of unaligned reads followed by unaligned writes, despite my efforts to have the writes aligned.

@eefriedman
Copy link
Contributor

Known limitation of LLVM IR representation of the llvm.memmove intrinsic; there's only one alignment parameter. There was an attempt to fix this in LLVM r253511, but it was reverted. Not sure what the current status is.

@Mark-Simulacrum
Copy link
Member

I don't know how to triage this since I don't really understand assembly, but this is what we get today: https://gist.github.com/Mark-Simulacrum/c1e2b1b651ed7c99a8257ee3f8b52fac.

@Mark-Simulacrum Mark-Simulacrum added I-slow Issue: Problems and improvements with respect to performance of generated code. A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Jun 22, 2017
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. C-enhancement Category: An issue proposing an enhancement or a PR with one. and removed C-bug Category: This is a bug. labels Jul 25, 2017
@steveklabnik
Copy link
Member

I am not sure how to triage either, as the OP didn't include the old asm output.

@kirillkh is this issue still relevant?

@hanna-kruppe
Copy link
Contributor

There's a huge block of movups instructions in the loop they mentioned, and no movaps ones, so I figure the issue is still present.

@kirillkh
Copy link
Author

kirillkh commented Nov 4, 2018

Yes, that is the issue.

@nikic
Copy link
Contributor

nikic commented Nov 4, 2018

This is likely going to be fixed by #55633.

@nikic
Copy link
Contributor

nikic commented Nov 11, 2018

Unfortunately #55633 did not fix this, because LLVM is still missing support for differing src/dst alignment in SelectionDAG construction.

@nikic
Copy link
Contributor

nikic commented Nov 14, 2018

I've submitted https://reviews.llvm.org/D54471 for supporting src/dst alignment in SelectionDAG.

@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. I-slow Issue: Problems and improvements with respect to performance of generated code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants