[gcc(refs/vendors/axis/heads/cris-decc0)] i386: Don't use ix86_tune_ctrl_string in parse_mtune_ctrl_str

Hans-Peter Nilsson hp@gcc.gnu.org
Wed Feb 12 06:08:00 GMT 2020


https://gcc.gnu.org/g:1e964774aec65472d7a0741d7faa6a884295fc81

commit 1e964774aec65472d7a0741d7faa6a884295fc81
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jan 28 04:43:34 2020 -0800

    i386: Don't use ix86_tune_ctrl_string in parse_mtune_ctrl_str
    
    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.

Diff:
---
 gcc/ChangeLog                  | 12 ++++++++++++
 gcc/config/i386/i386-options.c | 18 ++++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9fc93c9..2a000e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2020-01-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+	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.
+
 2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
 
 	PR rtl-optimization/87763
diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
index 2acc9fb..e0be493 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);



More information about the Gcc-cvs mailing list