Unable to achieve aligned writes
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.
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.
eefriedman at 2016-05-28 07:32:19
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 Rousskov at 2017-05-04 12:30:45
I am not sure how to triage either, as the OP didn't include the old asm output.
@kirillkh is this issue still relevant?
Steve Klabnik at 2018-10-31 20:11:16
There's a huge block of
movupsinstructions in the loop they mentioned, and nomovapsones, so I figure the issue is still present.Hanna Kruppe at 2018-10-31 20:18:30
Yes, that is the issue.
Kirill Khazan at 2018-11-04 05:43:20
This is likely going to be fixed by #55633.
Nikita Popov at 2018-11-04 09:27:37
Unfortunately #55633 did not fix this, because LLVM is still missing support for differing src/dst alignment in SelectionDAG construction.
Nikita Popov at 2018-11-11 11:56:43
I've submitted https://reviews.llvm.org/D54471 for supporting src/dst alignment in SelectionDAG.
Nikita Popov at 2018-11-14 18:36:33