Use aligned memcpy for struct assignment - #5292
thewilsonator wants to merge 1 commit into
Conversation
| if (src != dst) { | ||
| unsigned align = DtoAlignment(lhs->type); | ||
| DtoMemCpy(DtoType(lhs->type), dst, src, false, | ||
| align ? align : 1); |
There was a problem hiding this comment.
We should probably add a DtoMemCpy() overload taking both alignments.
There was a problem hiding this comment.
I think the problem here (see failing CI) is that the call gIR->ir->CreateMemCpy(dst, A, src, A, nbytes, false /*isVolatile*/); (where A is an alignment generated from the argument to DtoMemCpy) actually needs to derive the alignment from src/dst (which I presume are going to be alloca's?) through the Align/MaybeAlign.
There was a problem hiding this comment.
Assuming the rhs is always of the same (non-)qualified type as the lhs, we wouldn't need the separate alignments. Unless we really have assignments to/from under-aligned structs in the frontend, triggering this error, then we can't simply use the type alignments.
which I presume are going to be alloca's?
No, they can be anything.
No description provided.