Hiya,
I'm doing research on which optimization passes to enable in the
various -On flags, and I've stumbled onto a/some minor bug(s) and
problems with the GCC documentation for the 4.1.2 version:
* 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.
* On x86, -fschedule-insns is disabled, but -fschedule-insns2 (or the
corresponding internal flag flag_schedule_insns_after_reload) is
still being used... The reason for disabling fschedule-insns is
increased register pressure (and x86 has few registers already). I'm
not sure if this a bug, but why disable -fschedule-insns and leave -
fschedule-insns2 active? Because , according to the docs, fschedule-
insns2 = fschedule-insns + an additional pass. Any comments on this
are welcome...
I've file a bug report for the first issue (http://gcc.gnu.org/
bugzilla/show_bug.cgi?id=31586), but since this is easy to fix, I'd
like to fix it myself. The only thing holding me back is that I'm new
at this: I've never contributed to an open source project before, and
I'm only vaguely familiar with CVS and the likes. Is there a newbie-
guide to contributing to GCC? How can I make sure this fix is done
for 4.1, 4.2 _and_ 4.3?
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
- 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)
- the documentation for fmove-loop-invariants and ftree-loop-optimize
mentions they are enabled at -O1 when they are not
- finline-functions is enabled at -Os, but isn't listed so
I can imagine few people care about the exact flags enabled at -On,
but why list wrong information which will only confuse people (as it
did for me).
Last but not least, I have some questions:
- 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.
- 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"?
greetings,
Kenneth
--
Statistics are like a bikini. What they reveal is suggestive, but
what they conceal is vital (Aaron Levenstein)
Kenneth Hoste
ELIS - Ghent University
[EMAIL PROTECTED]
http://www.elis.ugent.be/~kehoste