This is the mail archive of the gcc@gcc.gnu.org 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: GCC -On optimization passes: flag and doc issues



On 17 Apr 2007, at 16:27, Ian Lance Taylor wrote:


Kenneth Hoste <kenneth.hoste@elis.ugent.be> writes:

* When using -falign-loops or -fno-align-loops the corresponding
internal variable 'align-loops' should be set to 0 (= use default
setting) or 1 (= no aligning) resp. When parsing the various flags, a
variable 'value' is used to set (value=1) or unset (value=0) the
corresponding flag. Unfortunately, these values should be reversed
for the -falign-X flags, which isn't done, and thus using -falign-
loops causes no aligning, while -fno-align-loops causes aligning with
the default setting for the arch you're compiling for. Same problem
for -falign-jumps, -falign-labels and -falign-functions.

Ouch. Thanks for noticing.

I hope I can fix this my self (should be fairly easy), once I get familiar with submitting patches.


A related question: how is decided which priority a bug gets?


Also, while trying to identify the flags enabled in the various -On
flags, I've run into incomplete or even wrong documentation regarding
the optimization passes. Some examples:

- the -fipa-X flags are not mentioned in the 4.1.2 documentation

Looks like a bug.

A documentation bug you mean?



- funit-at-a-time is still being reported as enabled in -O2 and
above, while it is already active in -O1 (this seems to fixed in the
4.3.0 docs though)

This would be a bug but it looks OK to me in 4.1.

Yes, you're right, sorry. It seems this was fixed in the 4.1.2 release.



- the documentation for fmove-loop-invariants and ftree-loop-optimize
mentions they are enabled at -O1 when they are not

Actually I think they are enabled at -O1. This is done in a slightly tricky way: they default to being on, but they have no effect unless the other loop optimization passes are run. I think it would be appropriate to clean this up to make the code more obvious.

Hmm, okay, thank you. Do you know of any other flags being activated like this in a 'hidden' way?



- finline-functions is enabled at -Os, but isn't listed so

Yes, this should be documented better. The general -finline-functions is not enabled at -Os. Only inlining of small functions is enabled. This is done by setting parameters.

Yes, I've noticed the setting of the parameters. But this should definitely be reflected in the documentation.



- Some flags are enabled by other flags (for example, fschedule-insns
enables fsched-interblock and fsched-spec according to the docs). I
was unable to find where in the source code this is done... And
because I want to incorporate as much active On-flags as possible,
I'd like to track down for which flags this is really true, and for
which the docs are out-of-date.

-fsched-interblock and -fsched-spec default to 1 in common.opt. But they have no effect unless you enable a scheduling pass.

Another example of 'hidden' flag-activation. Any more?



- When new optimization passes are completed, how is decided where
they go to (-O1, -O2, -O3, -Os, none)? For example, why did funit-at-
a-time switch from -O2 to -O1 a while ago? And, as I noticed from the
4.3.0 docs, why is fsplit-wide-types enabled at -O1, and not -O2? Is
there some testing done, or is it just people saying "I think X
belongs there"?

Where to put optimizations is a trade-off between the amount of time they take and the amount of good they do. The testing which is done is compilation time testing.

Hmm, okay. I still feel this is a bit ad-hoc. What about flags that don't get activated in any of the -On flags? Are these not stable enough yet on important architectures, or are there other reasons?


greetings,

K.

--

Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital (Aaron Levenstein)

Kenneth Hoste
ELIS - Ghent University
kenneth.hoste@elis.ugent.be
http://www.elis.ugent.be/~kehoste


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