svn commit: r334702 - head/sys/sys

Brooks Davis brooks at freebsd.org
Thu Jun 7 13:27:40 UTC 2018


On Thu, Jun 07, 2018 at 12:01:00AM -0400, Ravi Pokala wrote:
> > I believe the theory is that the compiler (remember, this is __builtin_memset) can optimize away portions of the zeroing, or can optimize zeroing for small sizes.
> 
> Ahhh! I didn't consider that the compiler would be doing analysis of the larger context, and potentially skipping zeroing parts that are set immediately after the call.

Clang does this.  It does make for some quite interesting object code,
but the result is that zeroing with __builtin_memset() is basically free
for mostly-initialized structures.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20180607/86784c23/attachment.sig>


More information about the svn-src-head mailing list