question about knowing when optimization options are used
Wed Mar 18 20:15:55 GMT 2020
On Tue, Mar 17, 2020 at 12:22:07PM +0000, Richard Sandiford wrote:
> Segher Boessenkool <firstname.lastname@example.org> writes:
> > On Mon, Mar 16, 2020 at 11:14:25PM +0000, Shrader, David Lee via Gcc-help wrote:
> >> Most optimizations are only enabled if an -O level is set on the command line. Otherwise they are disabled, even if individual optimization flags are specified.
> > Yes.
> >> The man page says to use `-Q --help=optimizers` to find out what is turned on for the different -O levels as configure-time options can make things different from the defaults shown later in that man page. However, I have found that, even when using -O0, I can turn on optimization options, at least according to the help output:
> > You can enable the *flags*, sure, but with -O0 those flags do not do
> > anything. Exactly as the text above says? The "even if" part.
> I think David's the right that the wording isn't clear though.
Oh yes, I didn't mean to suggest it is perfect as is, sorry.
> The documentation sets up a contrast between an option being "enabled"
> or merely "specified", with "enabled" meaning something like "have an
> effect". But the quoted output then undermines that by using "enabled"
> for what the documentation calls "specified":
> $> gcc -Q --help=optimizers -fmove-loop-invariants | grep "\-fmove-loop-invariants"
> -fmove-loop-invariants [enabled]
> I can definitely see why this is confusing.
Yeah. Help output is not documentation, but if they aren't in agreement,
what is a user to do? :-(
Does anyone have proposed improved wording, etc.?
More information about the Gcc-help