[Bug web/82197] New: Default flags enabled by GCC at -O3 by default appear to be out of sync with the GCC documentation
lookatyouhacker at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 12 22:08:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82197
Bug ID: 82197
Summary: Default flags enabled by GCC at -O3 by default appear
to be out of sync with the GCC documentation
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: web
Assignee: unassigned at gcc dot gnu.org
Reporter: lookatyouhacker at gmail dot com
Target Milestone: ---
The GCC online docs at this URL list the various optimization options GCC
offers:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
Notably, it says that O3 optimization should enable -ftree-loop-distribution.
However, my build of GCC 7.2.0 disables it with -O3 by default:
>gcc -c -Q -O3 --help=optimizers | grep distribut Tue 12 Sep 2017 09:37:44 AM EDT
-ftree-loop-distribute-patterns [enabled]
-ftree-loop-distribution [disabled]
I tracked down the problem to the GCC source code in gcc/opts.c, line 528:
/* -O3 optimizations. */
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fsplit_paths, NULL, 1 },
/* Inlining of functions reducing size is a good idea with -Os
regardless of them being declared inline. */
{ OPT_LEVELS_3_PLUS_AND_SIZE, OPT_finline_functions, NULL, 1 },
{ OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1
},
{ OPT_LEVELS_3_PLUS, OPT_fsplit_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_vectorize, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_slp_vectorize, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC
},
{ OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpeel_loops, NULL, 1 },
In here, it looks like there's no mention of OPT_ftree_loop_distribution. I
was wondering if this omission was intentional? It seems that either the
online docs should be updated to reflect this, or the code should be amended to
enable -ftree-loop-distribution with -O3. I can submit a patch to fix this if
it should in fact be in there.
Some discussion about this was had in this thread:
https://github.com/InBetweenNames/gentooLTO/issues/3
One user confirmed this goes at least as far back as 6.4.0.
Thoughts/suggestions?
Thank you,
Shane Peelar
More information about the Gcc-bugs
mailing list