Re: -Os is weak...

2010-09-26 Thread Gerald Pfeifer
On Fri, 10 Sep 2010, Steven Bosscher wrote: >> The docs say... >> >> @item -Os >> @opindex Os >> Optimize for size. �...@option{-os} enables all @option{-O2} optimizations >> that >> do not typically increase code size.  It also performs further >> optimizations designed to reduce code size. >> >>

Re: -Os is weak...

2010-09-16 Thread Jakub Jelinek
On Thu, Sep 16, 2010 at 10:55:22AM +0200, Andi Kleen wrote: > Try reading some examples from http://embed.cs.utah.edu/embarrassing/ > Since the criteria of the comparisons is code size it can show > you where gcc is behind some other compilers > > (but note that these comparisons do not include th

Re: -Os is weak...

2010-09-16 Thread Steven Bosscher
On Thu, Sep 16, 2010 at 9:35 AM, Yao Qi wrote: > Was CFO finally merged to mainline?  At least, I can't find it in > current gcc. Yes, it was merged. And then it was removed again because the implementation had several big problems. Such as, it didn't actually work. Ciao! Steven

Re: -Os is weak...

2010-09-16 Thread Andi Kleen
Yao Qi writes: > > During the investigation, I feel that all the potential improvements > are identified by ARM experts or by reading asm code manually. This > mode doesn't scale very well. IMO, it is necessary to have a > target-independent framework for code size optimization. I have no > ide

Re: -Os is weak...

2010-09-16 Thread Yao Qi
On Fri, Sep 10, 2010 at 10:44:24AM +0200, Steven Bosscher wrote: > On Thu, Sep 9, 2010 at 6:43 PM, DJ Delorie wrote: > > > I guess the most important missing optimizations are various forms of > code unification, such as the sequence abstraction code that GCC used > to have (http://gcc.gnu.org/p

Re: -Os is weak...

2010-09-10 Thread DJ Delorie
> Is there a particular target you're interested in? Not in that way, no. My biggest concern is that the documentation is wrong. My second concern is that the help option says it basically does nothing (well, one or two options) instead of the big list it used to do (or that the other -O* do).

Re: -Os is weak...

2010-09-10 Thread Steven Bosscher
On Thu, Sep 9, 2010 at 6:43 PM, DJ Delorie wrote: > > The docs say... > > @item -Os > @opindex Os > Optimize for size. �...@option{-os} enables all @option{-O2} optimizations > that > do not typically increase code size.  It also performs further > optimizations designed to reduce code size. > >

Re: -Os is weak...

2010-09-09 Thread Steven Bosscher
On Thu, Sep 9, 2010 at 6:43 PM, DJ Delorie wrote: > $ grep optimize_size *.c > genconditions.c:   { "! optimize_size && ! TARGET_READ_MODIFY_WRITE", > genconditions.c:     __builtin_constant_p (! optimize_size && ! > TARGET_READ_MODIFY_WRITE) > genconditions.c:     ? (int) (! optimize_size && ! T

Re: -Os is weak...

2010-09-09 Thread Steven Bosscher
On Thu, Sep 9, 2010 at 6:43 PM, DJ Delorie wrote: > $ grep optimize_size *.c Try egrep "optimize_.*_for_speed|optimize_.*_for_size" * config/*/* Ciao! Steven

Re: -Os is weak...

2010-09-09 Thread DJ Delorie
> Some backends also check optimize_size to change their cost algorithms > to favor shorter instruction sequences. But why doesn't it do what the documentation says? -falign-* seems like an obvious one - aligning labels and such always makes the code bigger.

Re: -Os is weak...

2010-09-09 Thread Andrew Pinski
On Thu, Sep 9, 2010 at 10:16 AM, Ian Lance Taylor wrote: > Some backends also check optimize_size to change their cost algorithms > to favor shorter instruction sequences. Also see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16996 for all the other known code size improvements that could be done.

Re: -Os is weak...

2010-09-09 Thread Ian Lance Taylor
DJ Delorie writes: > But in reality, the only thing -Os does beyond -O2, aside from a few > niche special cases, is enable inlining, and maybe scheduling, which > for some cases may be the wrong thing to do. Some backends also check optimize_size to change their cost algorithms to favor shorter

-Os is weak...

2010-09-09 Thread DJ Delorie
The docs say... @item -Os @opindex Os Optimize for size. @option{-Os} enables all @option{-O2} optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size. @option{-Os} disables the following optimization flags: @gccoptlist{-falig