diff mbox

Enabling -frename-registers?

Message ID 56ABA2BA.3030705@redhat.com
State New
Headers show

Commit Message

Bernd Schmidt Jan. 29, 2016, 5:34 p.m. UTC
So PR57193 has an example of sub-optimal code generation, with some 
unnecessary register moves left after LRA. These seem to be difficult to 
prevent, but last year Robert Suchanek made some modifications to 
regrename that allow it to clean up such cases. Enabling 
-frename-registers removes one of the two unnecessary copies, and I'm 
pretty sure I could make it eliminate the other one as well with a bit 
more work.

Hence, this patch. The renamer has seen a lot of fixes over the years 
and should be in pretty good shape IMO. Still, I won't deny that this is 
a bit riskier than the usual bugfix patch at this stage.

Bootstrapped and tested on x86_64-linux, with my earlier patch to fix 
some i386 tests. Thoughts? Should we do this for gcc-7 at least?


Bernd

Comments

Richard Biener Jan. 29, 2016, 6:50 p.m. UTC | #1
On January 29, 2016 6:34:50 PM GMT+01:00, Bernd Schmidt <bschmidt@redhat.com> wrote:
>So PR57193 has an example of sub-optimal code generation, with some 
>unnecessary register moves left after LRA. These seem to be difficult
>to 
>prevent, but last year Robert Suchanek made some modifications to 
>regrename that allow it to clean up such cases. Enabling 
>-frename-registers removes one of the two unnecessary copies, and I'm 
>pretty sure I could make it eliminate the other one as well with a bit 
>more work.
>
>Hence, this patch. The renamer has seen a lot of fixes over the years 
>and should be in pretty good shape IMO. Still, I won't deny that this
>is 
>a bit riskier than the usual bugfix patch at this stage.
>
>Bootstrapped and tested on x86_64-linux, with my earlier patch to fix 
>some i386 tests. Thoughts? Should we do this for gcc-7 at least?

I don't think it's appropriate at this stage.

Richard.

>
>Bernd
Jeff Law April 17, 2016, 6:59 p.m. UTC | #2
On 01/29/2016 10:34 AM, Bernd Schmidt wrote:
> So PR57193 has an example of sub-optimal code generation, with some
> unnecessary register moves left after LRA. These seem to be difficult to
> prevent, but last year Robert Suchanek made some modifications to
> regrename that allow it to clean up such cases. Enabling
> -frename-registers removes one of the two unnecessary copies, and I'm
> pretty sure I could make it eliminate the other one as well with a bit
> more work.
>
> Hence, this patch. The renamer has seen a lot of fixes over the years
> and should be in pretty good shape IMO. Still, I won't deny that this is
> a bit riskier than the usual bugfix patch at this stage.
>
> Bootstrapped and tested on x86_64-linux, with my earlier patch to fix
> some i386 tests. Thoughts? Should we do this for gcc-7 at least?
invoke.texi has an independent list (probably incomplete! ;( of all the 
things that -O2 enables.  Make sure to add -frename-registers to that 
list and this is Ok for the trunk (gcc-7).


jeff
diff mbox

Patch

	PR rtl-optimization/57193
	* opts.c (default_options_table): Add OPT_frename_registers at -O2
	and above.
	* doc/invoke.texi (-frename-registers): Update documentation.

Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 232689)
+++ gcc/opts.c	(working copy)
@@ -498,6 +498,7 @@  static const struct default_options defa
     { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
     { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_freorder_blocks_algorithm_, NULL,
       REORDER_BLOCKS_ALGORITHM_STC },
+    { OPT_LEVELS_2_PLUS, OPT_frename_registers, NULL, 1 },
     { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
     { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
     { OPT_LEVELS_2_PLUS, OPT_ftree_pre, NULL, 1 },
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 232689)
+++ gcc/doc/invoke.texi	(working copy)
@@ -8467,7 +8467,8 @@  debug information format adopted by the
 make debugging impossible, since variables no longer stay in
 a ``home register''.
 
-Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
+Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops},
+and also enabled at levels @option{-O2} and @option{-O3}.
 
 @item -fschedule-fusion
 @opindex fschedule-fusion