On Tue, Mar 4, 2025 at 9:49 AM Richard Sandiford
<[email protected]> wrote:
>
> Wilco Dijkstra <[email protected]> writes:
> > Hi Richard&Kyrill,
> >
> >>> I’m in favour of this.
> >>
> >> Yeah, seems ok to me too. I suppose we ought to update the documentation
> >> too:
> >
> > I've added a note to the documentation. However it is impossible to be
> > complete here
> > since many targets switch off early scheduling under various circumstances.
>
> Yeah, that's fair. :)
>
> > So I've just mentioned what x86 and AArch64 do (see v2 below).
>
> SGTM. Getting it right for two target is a strict improvement
> over the status quo. Wording suggestion below though:
Note the documentation issue for x86 not enabling the pre-RA scheduler
at -O2+ is PR 38768; though it was closed as fixed but it was not
actually fixed (I think there was a missing reading of the sources).
So please add a reference to PR 38768 in the commit message.
Thanks,
Andrew Pinski
>
> > Cheers,
> > Wilco
> >
> >
> > v2: Update documentation
> >
> > Enable the early scheduler on AArch64 for O3/Ofast. This means GCC15
> > benefits
> > from much faster build times with -O2, but avoids the regressions in lbm
> > which
> > is very sensitive to minor scheduling changes due to long FMA chains.
> >
> > gcc:
> > PR target/118351
> > * common/config/aarch64/aarch64-common.cc: Enable early scheduling
> > with
> > -O3 and higher.
> > * doc/invoke.texi (-fschedule-insns): Update comment.
> >
> > ---
> >
> > diff --git a/gcc/common/config/aarch64/aarch64-common.cc
> > b/gcc/common/config/aarch64/aarch64-common.cc
> > index
> > 3d694f16d1fd84e142254a4880c91a7f053e72aa..3044336923415d9414b6c66e66d872612ead24cd
> > 100644
> > --- a/gcc/common/config/aarch64/aarch64-common.cc
> > +++ b/gcc/common/config/aarch64/aarch64-common.cc
> > @@ -54,8 +54,10 @@ static const struct default_options
> > aarch_option_optimization_table[] =
> > { OPT_LEVELS_FAST, OPT_fomit_frame_pointer, NULL, 1 },
> > /* Enable -fsched-pressure by default when optimizing. */
> > { OPT_LEVELS_1_PLUS, OPT_fsched_pressure, NULL, 1 },
> > - /* Disable early scheduling due to high compile-time overheads. */
> > + /* Except for -O3 and higher, disable early scheduling due to high
> > + compile-time overheads. */
> > { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 },
> > + { OPT_LEVELS_3_PLUS, OPT_fschedule_insns, NULL, 1 },
> > /* Enable redundant extension instructions removal at -O2 and higher.
> > */
> > { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 },
> > { OPT_LEVELS_2_PLUS, OPT_mearly_ra_, NULL, AARCH64_EARLY_RA_ALL },
> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > index
> > bad49a017cc1bb0922eba9f0b2db80166d409cd7..5eb2e96c483126ad075b427969e8c02ce3f51e7a
> > 100644
> > --- a/gcc/doc/invoke.texi
> > +++ b/gcc/doc/invoke.texi
> > @@ -13503,7 +13503,9 @@ helps machines that have slow floating point or
> > memory load instructions
> > by allowing other instructions to be issued until the result of the load
> > or floating-point instruction is required.
> >
> > -Enabled at levels @option{-O2}, @option{-O3}.
> > +Enabled at levels @option{-O2}, @option{-O3}. Many targets use a different
> > +default, for example, it is disabled on x86 and enabled only at level
> > +@option{-O3} on AArch64.
>
> Very minor, and this is going to be personal taste, but how about:
>
> Conventionally enabled at optimization levels @option{-O2} and @option{-O3}.
> However, many targets override this behavior. For example, on x86, it is
> disabled at all levels, while on AArch64, it is enabled only at @option{-O3}.
>
> (I'm just trying to avoid the second sentence contradicting the first.)
>
> OK with that change if noone objects in 24hrs.
>
> Thanks,
> Richard
>