[PATCH] Fix handling of flag_rename_registers.

Martin Liška mliska@suse.cz
Tue Oct 12 12:17:33 GMT 2021


Hello.

The option is disabled in rs6000 target with:

     { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 },

Thus, we have to do an auto-detection only if it's really unset and also
equal to the Init value.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
And the problematic test-case works on ppc64le.

Ready to be installed?
Thanks,
Martin

	PR target/102688

gcc/ChangeLog:

	* common.opt: Enable flag_rename_registers by default.
	* toplev.c (process_options): Auto-detect flag_rename_registers
	only if it is not turned off in a target.
---
  gcc/common.opt | 2 +-
  gcc/toplev.c   | 3 ++-
  2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 4099effcc80..2c6be1bdd36 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2399,7 +2399,7 @@ Common Var(flag_live_range_shrinkage) Init(0) Optimization
  Relief of register pressure through live range shrinkage.
  
  frename-registers
-Common Var(flag_rename_registers) Optimization
+Common Var(flag_rename_registers) Init(1) Optimization
  Perform a register renaming optimization pass.
  
  fschedule-fusion
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 167feac2583..ee7d8854f90 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1335,7 +1335,8 @@ process_options (bool no_backend)
    if (!OPTION_SET_P (flag_web))
      flag_web = flag_unroll_loops;
  
-  if (!OPTION_SET_P (flag_rename_registers))
+  /* The option can be turned off in a target.  */
+  if (!OPTION_SET_P (flag_rename_registers) && flag_rename_registers)
      flag_rename_registers = flag_unroll_loops;
  
    if (flag_non_call_exceptions)
-- 
2.33.0



More information about the Gcc-patches mailing list