<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 6, 2013, at 1:40 PM, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Folks,<div><br></div><div style="">I'm trying to rationalize about optimization levels and maybe we should come up with a document like this:</div><div style=""><br></div><div style=""><a href="http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html</a><br>
</div><div style=""><br></div><div style="">Though, I remember a discussion a few months ago, and some people recommended we had names, rather than numbers, to dissociate the idea that 3 is better than 2. Regardless, would be good to have some guidelines on what goes where, so we don't end up in yet another long discussion about where to put the optimization <insert-name-here>.</div>
<div style=""><br></div><div style="">As far as I can get from our side is:<br></div><div style=""><br></div><div style="">-O3 : throw everything and hope it sticks</div><div style="">-O2 : optimized build, but should not explode in code size nor consume all resources while compiling</div>
<div style="">-O1 : optimized debug binaries, don't change the execution order but remove dead code and stuff</div><div style="">-O0 : don't touch it</div><div style="">-Os : optimize, but don't run passes that could blow up code. Try to be a bit more drastic when removing code. When in doubt, prefer small, not fast code.</div>
<div style="">-Oz : only perform optimizations that reduce code size. Don't even try to run things that could potentially increase code size.</div></div></blockquote><div><br></div><div>I think that this is a pretty good codification of how things work, but we should separate out the mechanics (e.g. running passes) from the goals (don't blow up code size).  Something like this definitely should be in the Clang user docs.  The LLVM docs should have something similar but less "GCC command line option" centric.</div><div><br></div><div>-Chris</div><br><br></div><br></body></html>