public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* -O1 single optimization parameter
@ 2008-10-08 15:59 massimiliano cialdi
  2008-10-08 16:16 ` Andrew Haley
  0 siblings, 1 reply; 8+ messages in thread
From: massimiliano cialdi @ 2008-10-08 15:59 UTC (permalink / raw)
  To: gcc-help

I use gcc 4.2.2 and I tried both -O0 and -O1.
If I use -O1 I can see that use of stack is better.
In gcc manual (http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Optimize-Options.html#Optimize-Options)
is reported that -O1 activate
-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

so in gcc command line I have replaced -O1 with all these parameters,
but I obtain a larger binary and a worst stack usage. Is the same
thing of -O0.
How can I reproduce -O1 behaviour using simple command line parameter?

thanks

-- 
Pro pace mundi adversus meganoides tertio Daitarn pugnabo.
Nisi times hanc vim, pugna!

Massimiliano Cialdi
cialdi@gmail.com
massimiliano.cialdi@powersoft.it

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

* Re: -O1 single optimization parameter
  2008-10-08 15:59 -O1 single optimization parameter massimiliano cialdi
@ 2008-10-08 16:16 ` Andrew Haley
  2008-10-09  8:10   ` massimiliano cialdi
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2008-10-08 16:16 UTC (permalink / raw)
  To: massimiliano cialdi; +Cc: gcc-help

massimiliano cialdi wrote:
> I use gcc 4.2.2 and I tried both -O0 and -O1.
> If I use -O1 I can see that use of stack is better.
> In gcc manual (http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Optimize-Options.html#Optimize-Options)
> is reported that -O1 activate
> -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
> 
> so in gcc command line I have replaced -O1 with all these parameters,
> but I obtain a larger binary and a worst stack usage. Is the same
> thing of -O0.

Right.

> How can I reproduce -O1 behaviour using simple command line parameter?

You can't have optimization without -O.

Andrew.

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

* Re: -O1 single optimization parameter
  2008-10-08 16:16 ` Andrew Haley
@ 2008-10-09  8:10   ` massimiliano cialdi
  2008-10-09  8:57     ` Andrew Haley
  0 siblings, 1 reply; 8+ messages in thread
From: massimiliano cialdi @ 2008-10-09  8:10 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-help

On Wed, Oct 8, 2008 at 6:15 PM, Andrew Haley <aph@redhat.com> wrote:
>> so in gcc command line I have replaced -O1 with all these parameters,
>> but I obtain a larger binary and a worst stack usage. Is the same
>> thing of -O0.
>> How can I reproduce -O1 behaviour using simple command line parameter?
>
> You can't have optimization without -O.
I tried two different build
one witch -O0
and the second with
-O1
-fno-defer-pop
-fno-delayed-branch
-fno-guess-branch-probability
-fno-cprop-registers
-fno-if-conversion
-fno-if-conversion2
-fno-tree-ccp
-fno-tree-dce
-fno-tree-dominator-opts
-fno-tree-dse
-fno-tree-ter
-fno-tree-lrs
-fno-tree-sra
-fno-tree-copyrename
-fno-tree-fre
-fno-tree-ch
-fno-unit-at-a-time
-fno-merge-constants
-fno-ipa-pure-const
-fno-ipa-reference
-fno-omit-frame-pointer
-fno-tree-copy-prop
-fno-tree-salias
-fno-tree-sink
-fno-var-tracking

to reproduce the -O0 behaviour

from .lst files in both cases I can read:

options enabled:  -falign-loops -fargument-alias -fbranch-count-reg
-fcommon -fdata-sections -fearly-inlining -feliminate-unused-debug-types
-ffunction-cse -ffunction-sections -fgcse-lm -fident
-finline-functions-called-once -fivopts -fkeep-static-consts
-fleading-underscore -fmath-errno -fmove-loop-invariants -fpeephole
-freg-struct-return -fsched-interblock -fsched-spec
-fsched-stalled-insns-dep -fshow-column -fsplit-ivs-in-unroller
-ftoplevel-reorder -ftrapping-math -ftree-loop-im -ftree-loop-ivcanon
-ftree-loop-optimize -ftree-vect-loop-version -fverbose-asm
-fzero-initialized-in-bss -mlittle-endian -msched-prolog

but when I compile with -O0 I obtain for example a 300KB binary and
too much stack usage.
In second case I obtain a 200KB binary and a very less stack usage
than -O0 case.

I need only stack usage optimization and NO code optimization (to let
us easly debug the code), which parameters I need to use?

thanks



-- 
Pro pace mundi adversus meganoides tertio Daitarn pugnabo.
Nisi times hanc vim, pugna!

Massimiliano Cialdi
cialdi@gmail.com
massimiliano.cialdi@powersoft.it

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

* Re: -O1 single optimization parameter
  2008-10-09  8:10   ` massimiliano cialdi
@ 2008-10-09  8:57     ` Andrew Haley
  2008-10-09 10:20       ` massimiliano cialdi
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2008-10-09  8:57 UTC (permalink / raw)
  To: massimiliano cialdi; +Cc: gcc-help

massimiliano cialdi wrote:

> I need only stack usage optimization and NO code optimization (to let
> us easly debug the code), which parameters I need to use?

It's not possible.

Andrew.

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

* Re: -O1 single optimization parameter
  2008-10-09  8:57     ` Andrew Haley
@ 2008-10-09 10:20       ` massimiliano cialdi
  2008-10-09 10:37         ` Andrew Haley
  0 siblings, 1 reply; 8+ messages in thread
From: massimiliano cialdi @ 2008-10-09 10:20 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-help

On Thu, Oct 9, 2008 at 10:57 AM, Andrew Haley <aph@redhat.com> wrote:
>> I need only stack usage optimization and NO code optimization (to let
>> us easly debug the code), which parameters I need to use?
> It's not possible.
I try to relax my constraint.
I need to reduce stack usage and keep the project debuggable (maybe
with some code optimization)
which set of parameters do I need to use.


Last, only for curiosity, how can I reproduce exacly the behaviour of -O0?
as I said in previous mail I tried with
-O1
-fno-defer-pop
-fno-delayed-branch
-fno-guess-branch-probability
-fno-cprop-registers
-fno-if-conversion
-fno-if-conversion2
-fno-tree-ccp
-fno-tree-dce
-fno-tree-dominator-opts
-fno-tree-dse
-fno-tree-ter
-fno-tree-lrs
-fno-tree-sra
-fno-tree-copyrename
-fno-tree-fre
-fno-tree-ch
-fno-unit-at-a-time
-fno-merge-constants
-fno-ipa-pure-const
-fno-ipa-reference
-fno-omit-frame-pointer
-fno-tree-copy-prop
-fno-tree-salias
-fno-tree-sink
-fno-var-tracking
-fno-caller-saves

and I obtain a binary quite much optimized than which one optained
only with -O0.
So which parameter are missing from that list?

thanks

-- 
Pro pace mundi adversus meganoides tertio Daitarn pugnabo.
Nisi times hanc vim, pugna!

Massimiliano Cialdi
cialdi@gmail.com
massimiliano.cialdi@powersoft.it

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

* Re: -O1 single optimization parameter
  2008-10-09 10:20       ` massimiliano cialdi
@ 2008-10-09 10:37         ` Andrew Haley
  2008-10-09 10:48           ` massimiliano cialdi
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2008-10-09 10:37 UTC (permalink / raw)
  To: massimiliano cialdi; +Cc: gcc-help

massimiliano cialdi wrote:
> On Thu, Oct 9, 2008 at 10:57 AM, Andrew Haley <aph@redhat.com> wrote:
>>> I need only stack usage optimization and NO code optimization (to let
>>> us easly debug the code), which parameters I need to use?
>> It's not possible.
> I try to relax my constraint.
> I need to reduce stack usage and keep the project debuggable (maybe
> with some code optimization)
> which set of parameters do I need to use.

> Last, only for curiosity, how can I reproduce exacly the behaviour of -O0?

By using -O0.

> as I said in previous mail I tried with
> -O1
> -fno-defer-pop
> -fno-delayed-branch
> -fno-guess-branch-probability
> -fno-cprop-registers
> -fno-if-conversion
> -fno-if-conversion2
> -fno-tree-ccp
> -fno-tree-dce
> -fno-tree-dominator-opts
> -fno-tree-dse
> -fno-tree-ter
> -fno-tree-lrs
> -fno-tree-sra
> -fno-tree-copyrename
> -fno-tree-fre
> -fno-tree-ch
> -fno-unit-at-a-time
> -fno-merge-constants
> -fno-ipa-pure-const
> -fno-ipa-reference
> -fno-omit-frame-pointer
> -fno-tree-copy-prop
> -fno-tree-salias
> -fno-tree-sink
> -fno-var-tracking
> -fno-caller-saves
> 
> and I obtain a binary quite much optimized than which one optained
> only with -O0.

As I'd expect: optimization is enabled.

> So which parameter are missing from that list?

You seem to think it is possible to do that.  I don't know why you
think such a thing.  I don't think it is possible.

You seem to believe that there is some magic set of command line options
that will duplicate the various -O flags.  There isn't.

There are lots of places in the compiler with things like

if (optimize > 0)
{
  ... do some optimization ...
}

Andrew.


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

* Re: -O1 single optimization parameter
  2008-10-09 10:37         ` Andrew Haley
@ 2008-10-09 10:48           ` massimiliano cialdi
  2008-10-09 11:08             ` Brian Dessent
  0 siblings, 1 reply; 8+ messages in thread
From: massimiliano cialdi @ 2008-10-09 10:48 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-help

On Thu, Oct 9, 2008 at 12:36 PM, Andrew Haley <aph@redhat.com> wrote:
>> So which parameter are missing from that list?
>
> You seem to think it is possible to do that.  I don't know why you
> think such a thing.  I don't think it is possible.
>
> You seem to believe that there is some magic set of command line options
> that will duplicate the various -O flags.  There isn't.
>
> There are lots of places in the compiler with things like
>
> if (optimize > 0)
> {
>  ... do some optimization ...
> }
I think that -O1 is an alias for a list of optimization parametr as
reported in gcc manual, so if I want to anable only one parameter at
time I think that I need to enable -O1 (that enable that set of
optimization) and explicitly disable all parameters that I don't want,
leaving only optimization parameter that I want.

thanks


-- 
Pro pace mundi adversus meganoides tertio Daitarn pugnabo.
Nisi times hanc vim, pugna!

Massimiliano Cialdi
cialdi@gmail.com
massimiliano.cialdi@powersoft.it

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

* Re: -O1 single optimization parameter
  2008-10-09 10:48           ` massimiliano cialdi
@ 2008-10-09 11:08             ` Brian Dessent
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dessent @ 2008-10-09 11:08 UTC (permalink / raw)
  To: massimiliano cialdi; +Cc: Andrew Haley, gcc-help

massimiliano cialdi wrote:

> I think that -O1 is an alias for a list of optimization parametr as
> reported in gcc manual, so if I want to anable only one parameter at

Your interpretation of the manual is incorrect.  Note in particular the
passage that says "Not all optimizations are controlled directly by a
flag. Only optimizations that have a flag are listed."  This is telling
you that -O is not equivalent to a set of -f options.

Brian

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

end of thread, other threads:[~2008-10-09 11:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-08 15:59 -O1 single optimization parameter massimiliano cialdi
2008-10-08 16:16 ` Andrew Haley
2008-10-09  8:10   ` massimiliano cialdi
2008-10-09  8:57     ` Andrew Haley
2008-10-09 10:20       ` massimiliano cialdi
2008-10-09 10:37         ` Andrew Haley
2008-10-09 10:48           ` massimiliano cialdi
2008-10-09 11:08             ` Brian Dessent

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).