Re: Optimization flags not working (GCC 4.2.4)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



slnc <s@xxxxxxx> writes:

> I have tried disabling all -O1 flags just to check if I could select
> only one by disabling all the others but:
>
> gcc -c -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 main.c
> objdump -d dce.o
>
> generates an optimized version. So why are the flags there if they
> cannot be selected individually? (I feel like I am missing something
> completely obvious..)

One view is that they can be selected individually.  However, there are
many optimizations which are not controlled by any flag.  And if you
don't turn on optimization, then gcc won't build the datastructures
needed for most of the optimization passes, so they won't be run even if
you explicitly ask for them.

Another view is that optimizations are not independent.  There is basic
work that has to be done for every optimization, like build the CFG, go
into SSA form, build the dataflow information, etc.  The main difference
between -O0 and -O1 is whether or not this basic work is done.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux