Fw: [PATCH][RFC] CC_OPTIMIZE_FOR_SIZE should default to N
robherring2 at gmail.com
Mon Mar 7 20:08:03 UTC 2011
On 03/07/2011 01:47 PM, Tom Gall wrote:
> To quote the GCC manual:
> Optimize for size. -Os enables all -O2 optimizations that do not
> typically increase code size. It also performs further optimizations
> designed to reduce code size.
> -Os disables the following optimization flags:
> -falign-functions -falign-jumps -falign-loops
> -falign-labels -freorder-blocks -freorder-blocks-and-partition
> -fprefetch-loop-arrays -ftree-vect-loop-version
> That said (and unless there's other undocumented differences), it
> would seem to take some expertise to comment on the trade off between
> memory efforts (cache misses, TLB etc) vs instructional effects by
> having these optimizations off.
> I am certainly not that expert but I suspect given the memory bus
> speeds that typical arm hardware has, we'd want -Os over -O2.
In my experience, -Os also turns off inlining of functions. The case I
have looked at is swab32 function in u-boot. With -Os (and
-march=armv7-a) I get calls to this function:
rev r0, r0
With -O2, I get rev inlined.
More information about the linaro-dev