On Mon, Jan 27, 2020 at 3:13 PM H.J. Lu <hjl.to...@gmail.com> wrote: > > There are > > static void > parse_mtune_ctrl_str (bool dump) > { > if (!ix86_tune_ctrl_string) > return; > > parse_mtune_ctrl_str is only called from set_ix86_tune_features, which > is only called from ix86_function_specific_restore and > ix86_option_override_internal. parse_mtune_ctrl_str shouldn't use > ix86_tune_ctrl_string which is defined with global_options. Instead, > opts should be passed to parse_mtune_ctrl_str. > > PR target/91399 > * config/i386/i386-options.c (set_ix86_tune_features): Add an > argument of a pointer to struct gcc_options and pass it to > parse_mtune_ctrl_str. > (ix86_function_specific_restore): Pass opts to > set_ix86_tune_features. > (ix86_option_override_internal): Likewise. > (parse_mtune_ctrl_str): Add an argument of a pointer to struct > gcc_options and use it for x_ix86_tune_ctrl_string.
Rubberstamp OK. I don't know this part well, but looks somehow obvious. Thanks, Uros. > --- > gcc/config/i386/i386-options.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c > index 2acc9fb0cfe..e0be4932534 100644 > --- a/gcc/config/i386/i386-options.c > +++ b/gcc/config/i386/i386-options.c > @@ -741,7 +741,8 @@ ix86_option_override_internal (bool main_args_p, > struct gcc_options *opts, > struct gcc_options *opts_set); > static void > -set_ix86_tune_features (enum processor_type ix86_tune, bool dump); > +set_ix86_tune_features (struct gcc_options *opts, > + enum processor_type ix86_tune, bool dump); > > /* Restore the current options */ > > @@ -810,7 +811,7 @@ ix86_function_specific_restore (struct gcc_options *opts, > > /* Recreate the tune optimization tests */ > if (old_tune != ix86_tune) > - set_ix86_tune_features (ix86_tune, false); > + set_ix86_tune_features (opts, ix86_tune, false); > } > > /* Adjust target options after streaming them in. This is mainly about > @@ -1538,13 +1539,13 @@ ix86_parse_stringop_strategy_string (char > *strategy_str, bool is_memset) > print the features that are explicitly set. */ > > static void > -parse_mtune_ctrl_str (bool dump) > +parse_mtune_ctrl_str (struct gcc_options *opts, bool dump) > { > - if (!ix86_tune_ctrl_string) > + if (!opts->x_ix86_tune_ctrl_string) > return; > > char *next_feature_string = NULL; > - char *curr_feature_string = xstrdup (ix86_tune_ctrl_string); > + char *curr_feature_string = xstrdup (opts->x_ix86_tune_ctrl_string); > char *orig = curr_feature_string; > int i; > do > @@ -1583,7 +1584,8 @@ parse_mtune_ctrl_str (bool dump) > processor type. */ > > static void > -set_ix86_tune_features (enum processor_type ix86_tune, bool dump) > +set_ix86_tune_features (struct gcc_options *opts, > + enum processor_type ix86_tune, bool dump) > { > unsigned HOST_WIDE_INT ix86_tune_mask = HOST_WIDE_INT_1U << ix86_tune; > int i; > @@ -1605,7 +1607,7 @@ set_ix86_tune_features (enum processor_type ix86_tune, > bool dump) > ix86_tune_features[i] ? "on" : "off"); > } > > - parse_mtune_ctrl_str (dump); > + parse_mtune_ctrl_str (opts, dump); > } > > > @@ -2364,7 +2366,7 @@ ix86_option_override_internal (bool main_args_p, > XDELETEVEC (s); > } > > - set_ix86_tune_features (ix86_tune, opts->x_ix86_dump_tunes); > + set_ix86_tune_features (opts, ix86_tune, opts->x_ix86_dump_tunes); > > ix86_recompute_optlev_based_flags (opts, opts_set); > > -- > 2.24.1 >