diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-08-12 17:00:41 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-08-12 17:00:41 +0200 |
commit | fe9458c280dbd6e8b892db4ca3b64185049c376b (patch) | |
tree | 9156a7d995e9daa69fbe8f8b98c8f918db9df51e /gcc/toplev.c | |
parent | a12026e9dd19caee8ce2f53e703564480e9709d4 (diff) | |
download | gcc-fe9458c280dbd6e8b892db4ca3b64185049c376b.zip gcc-fe9458c280dbd6e8b892db4ca3b64185049c376b.tar.gz gcc-fe9458c280dbd6e8b892db4ca3b64185049c376b.tar.bz2 |
Fix up flag_cunroll_grow_size handling in presence of optimize attr [PR96535]
As the testcase in the PR shows (not included in the patch, as
it seems quite fragile to observe unrolling in the IL), the introduction of
flag_cunroll_grow_size broke optimize attribute related to loop unrolling.
The problem is that the new option flag is set (if not set explicitly) only
in process_options and in rs6000_option_override_internal (and there only if
global_init_p). So, this means that while it is Optimization option, it
will only be set based on the command line -funroll-loops/-O3/-fpeel-loops
or -funroll-all-loops, which means that if command line does include any of
those, it is enabled even for functions that will through optimize attribute
have all of those disabled, and if command line does not include those,
it will not be enabled for functions that will through optimize attribute
have any of those enabled.
process_options is called just once, so IMHO it should be handling only
non-Optimization option adjustments (various other options suffer from that
too, but as this is a regression from 10.1 on the 10 branch, changing those
is not appropriate). Similarly, rs6000_option_override_internal is called
only once (with global_init_p) and then for target attribute handling, but
not for optimize attribute handling.
This patch moves the unrolling related handling from process_options into
finish_options which is invoked whenever the options are being finalized,
and the rs6000 specific parts into the override_options_after_change hook
which is called for optimize attribute handling (and unfortunately also
th cfun changes, but what the hook does is cheap) and I've added a call to
that from rs6000_override_options_internal, so it is also called on cmdline
processing and for target attribute.
Furthermore, it stops using AUTODETECT_VALUE, which can work only once,
and instead uses the global_options_set.x_... flags.
2020-08-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96535
* toplev.c (process_options): Move flag_unroll_loops and
flag_cunroll_grow_size handling from here to ...
* opts.c (finish_options): ... here. For flag_cunroll_grow_size,
don't check for AUTODETECT_VALUE, but instead check
opts_set->x_flag_cunroll_grow_size.
* common.opt (funroll-completely-grow-size): Default to 0.
* config/rs6000/rs6000.c (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE):
Redefine.
(rs6000_override_options_after_change): New function.
(rs6000_option_override_internal): Call it. Move there the
flag_cunroll_grow_size, unroll_only_small_loops and
flag_rename_registers handling.
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index 9a78af1..07457d08c 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1474,16 +1474,6 @@ process_options (void) flag_abi_version = 2; } - /* Unrolling all loops implies that standard loop unrolling must also - be done. */ - if (flag_unroll_all_loops) - flag_unroll_loops = 1; - - /* Allow cunroll to grow size accordingly. */ - if (flag_cunroll_grow_size == AUTODETECT_VALUE) - flag_cunroll_grow_size - = flag_unroll_loops || flag_peel_loops || optimize >= 3; - /* web and rename-registers help when run after loop unrolling. */ if (flag_web == AUTODETECT_VALUE) flag_web = flag_unroll_loops; |