This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -O* Gives Different Results than Individual Optimizations?

Alexey Salmin <> writes:

> On 10/12/09, Kevin P. Fleming <> wrote:
>> This is frequently asked on this list, and the answer is always the
>> same: yes, the -O<N> flag does more than just enable a series of -f<foo>
>> flags. Said another way, there are optimizations that do *not* have
>> -f<foo> flags that control them, they are enabled by directly checking
>> the value supplied to the -O flag, and they cannot be directly controlled.
> And what's the purpose of that?

Simplicity.  There are many dependencies between different
optimizations.  Rather than represent all of these dependencies in a
data structure, many passes are simply run at certain optimization
levels.  The compiler could be organized differently, but making that
continue to work would impose a significant testing burden: it would
be necessary to test many combinations of options to make sure that
they remained effective.

Also, frankly, the compiler already has too many command line
options.  Adding a separate command line option for each separate
optimization, above and beyond -O1, -O2, etc., would increase
complexity for little gain.

Which is to say: it would not be impossible, but it would be an
ongoing maintenance burden, and there would be no benefit for the
average user of gcc.  Given that gcc is free software, this is
something that will only be done if some contributor takes a serious
an ongoing interest in making it work.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]