This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 4.0.2 optimization O1
gandhi@cs.umn.edu writes:
> I have a question related to using the O1 option in gcc C to optimize the
> code.
>
> With the compile option of -O1, my program takes 1.5 units to run.
>
> However, when I compile the program with all the flags* for O1 instead of
> -O1 itself, my program takes 3 units to run.
>
> Can anybody tell me why is this difference? Is there more to what O1 does
> than just turning the specified flags on?
Lots of things. There are many places in the compiler with the phrase
"if (optimize)". Enabling the optimization options individually
doesn't enable optimization in general.
> I am primarily interested to know which optimizations where effective for
> my code.
Right, so use -O1 and turn individual optimizations *off*.
Andrew.