[PATCH] memset 0 in obscure is optimized away by compiler

Rich Felker dalias at libc.org
Wed Apr 16 17:28:27 UTC 2014


On Wed, Apr 16, 2014 at 07:14:05PM +0200, Harald Becker wrote:
> Hi Tito !
> 
> >I've tried to find out if memset is really optimized away in
> >this case with some test code that I've compiled with :
> 
> What is wrong with optimization of code, e.g. replacing call to
> memset by a quick loop which does same thing even faster than a
> function call? ... beside that such optimization needs normally a
> bit more of space it is faster and does same thing as original
> function call. Try using size optimization (-Os) to avoid
> replacing function calls by inline replacements.

The quick loop will equally be optimized away, as neither it nor the
memset have any observable effect.

Rich


More information about the busybox mailing list