-----Original Message-----
From: Brooks Davis <bro...@freebsd.org>
Date: 2018-06-07, Thursday at 09:27
To: Ravi Pokala <rpok...@freebsd.org>
Cc: "Jonathan T. Looney" <j...@freebsd.org>, Mateusz Guzik <mjgu...@gmail.com>, 
Mateusz Guzik <m...@freebsd.org>, src-committers <src-committ...@freebsd.org>, 
<svn-src-...@freebsd.org>, <svn-src-head@freebsd.org>
Subject: Re: svn commit: r334702 - head/sys/sys

> 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

Yeah, it's a subtle but obvious optimization in hindsight. Thanks for the info.

-Ravi (rpokala@)


_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to