]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Fix ix86_option override after change [PR 113719]
authorHongyu Wang <hongyu.wang@intel.com>
Wed, 15 May 2024 03:24:34 +0000 (11:24 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Wed, 29 May 2024 08:59:59 +0000 (16:59 +0800)
In ix86_override_options_after_change, calls to ix86_default_align
and ix86_recompute_optlev_based_flags will cause mismatched target
opt_set when doing cl_optimization_restore. Move them back to
ix86_option_override_internal to solve the issue.

gcc/ChangeLog:

PR target/113719
* config/i386/i386-options.cc (ix86_override_options_after_change):
Remove call to ix86_default_align and
ix86_recompute_optlev_based_flags.
(ix86_option_override_internal): Call ix86_default_align and
ix86_recompute_optlev_based_flags.

gcc/config/i386/i386-options.cc

index 78602a17f7eba56871dc34d9c32996789f95f2c0..f2cecc0e2545bc8205446b499e88c492576f037f 100644 (file)
@@ -1916,11 +1916,6 @@ ix86_recompute_optlev_based_flags (struct gcc_options *opts,
 void
 ix86_override_options_after_change (void)
 {
-  /* Default align_* from the processor table.  */
-  ix86_default_align (&global_options);
-
-  ix86_recompute_optlev_based_flags (&global_options, &global_options_set);
-
   /* Disable unrolling small loops when there's explicit
      -f{,no}unroll-loop.  */
   if ((OPTION_SET_P (flag_unroll_loops))
@@ -2491,6 +2486,8 @@ ix86_option_override_internal (bool main_args_p,
 
   set_ix86_tune_features (opts, ix86_tune, opts->x_ix86_dump_tunes);
 
+  ix86_recompute_optlev_based_flags (opts, opts_set);
+
   ix86_override_options_after_change ();
 
   ix86_tune_cost = processor_cost_table[ix86_tune];
@@ -2526,6 +2523,9 @@ ix86_option_override_internal (bool main_args_p,
       || TARGET_64BIT_P (opts->x_ix86_isa_flags))
     opts->x_ix86_regparm = REGPARM_MAX;
 
+  /* Default align_* from the processor table.  */
+  ix86_default_align (&global_options);
+
   /* Provide default for -mbranch-cost= value.  */
   SET_OPTION_IF_UNSET (opts, opts_set, ix86_branch_cost,
                       ix86_tune_cost->branch_cost);