public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* -O more than the sum of its parts?
       [not found] <7088dd691003081924l2c75ec98tca557585304a9e73@mail.gmail.com>
@ 2010-03-09  3:31 ` drew stortz
  2010-03-09  3:43   ` me22
  2010-03-09  4:09   ` Alexey Salmin
  0 siblings, 2 replies; 5+ messages in thread
From: drew stortz @ 2010-03-09  3:31 UTC (permalink / raw)
  To: gcc-help

From the following page

http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Optimize-Options.html#Optimize-Options

I gather that using GCC 4.2.2 with the -O option is the equivalent of
using all of the following options explicitly: -fdefer-pop
-fdelayed-branch -fguess-branch-probability -fcprop-registers
-fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce
-ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra
-ftree-copyrename -ftree-fre -ftree-ch -funit-at-a-time
-fmerge-constants -fomit-frame-pointer

However, experiment tells me that this is far from true.  When I
compile the same c file both ways, the object file produced with -O is
around 20% smaller than the one produced with all of the individual
optimizations added.  Before filing a bug or investigating further, I
wanted to ask the list: is my interpretation of the -O switch
incorrect?  Is it more than just the sum of those individual
optimizations?

I’m using sles9 sp3 on an x86-64 machine, and the observation hold
whether using -m32 or -m64 and also whether I include or exclude
-fomit-frame-pointer

thanks for your help,
Drew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: -O more than the sum of its parts?
  2010-03-09  3:31 ` -O more than the sum of its parts? drew stortz
@ 2010-03-09  3:43   ` me22
  2010-03-12  8:27     ` Diego Novillo
  2010-03-09  4:09   ` Alexey Salmin
  1 sibling, 1 reply; 5+ messages in thread
From: me22 @ 2010-03-09  3:43 UTC (permalink / raw)
  To: drew stortz; +Cc: gcc-help

On 8 March 2010 22:31, drew stortz <drew.stortz@gmail.com> wrote:
>
> However, experiment tells me that this is far from true.  When I
> compile the same c file both ways, the object file produced with -O is
> around 20% smaller than the one produced with all of the individual
> optimizations added.  Before filing a bug or investigating further, I
> wanted to ask the list: is my interpretation of the -O switch
> incorrect?  Is it more than just the sum of those individual
> optimizations?
>

Yes; My understanding is that all of the -O levels have features not
controllable with individual flags.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: -O more than the sum of its parts?
  2010-03-09  3:31 ` -O more than the sum of its parts? drew stortz
  2010-03-09  3:43   ` me22
@ 2010-03-09  4:09   ` Alexey Salmin
  2010-03-14  6:40     ` NightStrike
  1 sibling, 1 reply; 5+ messages in thread
From: Alexey Salmin @ 2010-03-09  4:09 UTC (permalink / raw)
  To: drew stortz; +Cc: gcc-help

On Tue, Mar 9, 2010 at 9:31 AM, drew stortz <drew.stortz@gmail.com> wrote:
> From the following page
>
> http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Optimize-Options.html#Optimize-Options
>
> I gather that using GCC 4.2.2 with the -O option is the equivalent of
> using all of the following options explicitly: -fdefer-pop
> -fdelayed-branch -fguess-branch-probability -fcprop-registers
> -fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce
> -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra
> -ftree-copyrename -ftree-fre -ftree-ch -funit-at-a-time
> -fmerge-constants -fomit-frame-pointer
>
> However, experiment tells me that this is far from true.  When I
> compile the same c file both ways, the object file produced with -O is
> around 20% smaller than the one produced with all of the individual
> optimizations added.  Before filing a bug or investigating further, I
> wanted to ask the list: is my interpretation of the -O switch
> incorrect?  Is it more than just the sum of those individual
> optimizations?
>
> I’m using sles9 sp3 on an x86-64 machine, and the observation hold
> whether using -m32 or -m64 and also whether I include or exclude
> -fomit-frame-pointer
>
> thanks for your help,
> Drew
>

http://gcc.gnu.org/ml/gcc-help/2009-10/msg00128.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: -O more than the sum of its parts?
  2010-03-09  3:43   ` me22
@ 2010-03-12  8:27     ` Diego Novillo
  0 siblings, 0 replies; 5+ messages in thread
From: Diego Novillo @ 2010-03-12  8:27 UTC (permalink / raw)
  To: me22; +Cc: drew stortz, gcc-help

On Mon, Mar 8, 2010 at 22:43, me22 <me22.ca@gmail.com> wrote:

> Yes; My understanding is that all of the -O levels have features not
> controllable with individual flags.

Correct.  You can see for yourself by grepping for uses of the
variable 'optimize' in the GCC source code.  Many code paths are
affected by it.


Diego.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: -O more than the sum of its parts?
  2010-03-09  4:09   ` Alexey Salmin
@ 2010-03-14  6:40     ` NightStrike
  0 siblings, 0 replies; 5+ messages in thread
From: NightStrike @ 2010-03-14  6:40 UTC (permalink / raw)
  To: Alexey Salmin; +Cc: drew stortz, gcc-help

On Mon, Mar 8, 2010 at 11:09 PM, Alexey Salmin <alexey.salmin@gmail.com> wrote:
>> optimizations added.  Before filing a bug or investigating further, I
>> wanted to ask the list: is my interpretation of the -O switch
>> incorrect?  Is it more than just the sum of those individual
>> optimizations?
>
> http://gcc.gnu.org/ml/gcc-help/2009-10/msg00128.html
>

Also, the post with the full explanation is here, further down in the thread:
http://gcc.gnu.org/ml/gcc-help/2009-10/msg00134.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-13  2:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <7088dd691003081924l2c75ec98tca557585304a9e73@mail.gmail.com>
2010-03-09  3:31 ` -O more than the sum of its parts? drew stortz
2010-03-09  3:43   ` me22
2010-03-12  8:27     ` Diego Novillo
2010-03-09  4:09   ` Alexey Salmin
2010-03-14  6:40     ` NightStrike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).