[cfe-dev] struct copy
mattias at virtutech.se
Fri Sep 26 13:51:08 PDT 2008
Chris Lattner <clattner at apple.com> writes:
>In practice, using memcpy for small structs is bad, which is why llvm-
>gcc lowers it. The badness stems from two reasons: 1) current
>deficiencies in the optimizer, and 2) not being able to model the fact
>that a memcpy doesn't need to copy the "holes" in a struct.
How would not copying the holes improve anything? They are there for
alignment, but moving entire machine words is no slower than
However, if using the memcpy primitive means losing alignment
information and making pessimistic assumptions, then that is of course
an argument against memcpy.
More information about the cfe-dev