Hi all,
I’m have a question about the behavior of the “FindOptimalMemOpLowering” function.
It is mentioned that this function only need to look at the “DstAlign” and not the “SrcAlign” because “SrcAlign” is always greater than “DstAlign”.
But if “DstAlign” is equal to zero and “SrcAlign” to one the condition is respected. But in this case, wouldn’t we want to take “SrcAlign” into account instead of “DstAlign”.
I have a code where the source is a buffer of bytes (aligned on 1-byte for my backend), and a destination which is the stack, which is seen by LLVM as an object which alignment can change (SelectionDAG.cpp: getMemcpyLoadsAndStores), and so “DstAlign” is set to zero.
At the end, I have a memcpy which is inlined, the stores are well aligned with the stack, but the loads are aligned on MVT:i64 because the “SrcAlign” was not taken into account in “FindOptimalMemOpLowering”.
I have the default implementation of the “getOptimalMemOpType”.
Can someone tell me if I’m misunderstanding the behavior of this function, or if there is something to fix.
Thanks,
Romaric