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. So 
I've just
mentioned what x86 and AArch64 do (see v2 below).

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.
 
 @opindex fschedule-insns2
 @item -fschedule-insns2

Reply via email to