RTL cprop vs. fixed hard regs

Segher Boessenkool segher@kernel.crashing.org
Thu Jan 29 20:24:00 GMT 2015


On Fri, Jan 30, 2015 at 01:05:54AM +1030, Alan Modra wrote:
> Segher, does this one look better to you?  The previous patch turned
> off constant propagation for fixed registers as well as register copy
> propagation.  The latter is all I really meant to do.

I'm still not happy about not constant propagating any fixed reg.
But if what you really care about is register variables (as in the
testcase), you could test for that?  Just global register vars or all
register vars, either works for me (not that I have to approve it ;-) )

Minor things:

> Index: gcc/cprop.c
> ===================================================================
> --- gcc/cprop.c	(revision 219792)
> +++ gcc/cprop.c	(working copy)
> @@ -1207,7 +1207,11 @@
>  
>  	  if (cprop_constant_p (this_rtx))
>  	    newcnst = this_rtx;
> -	  if (REG_P (this_rtx) && REGNO (this_rtx) >= FIRST_PSEUDO_REGISTER
> +	  if (REG_P (this_rtx)
> +	      && REGNO (this_rtx) >= FIRST_PSEUDO_REGISTER
> +	      /* Don't copy propagate fixed regs.  This just tends to
> +		 extend the lifetime of this_rtx to no purpose.  */
> +	      && (REGNO (x) >= FIRST_PSEUDO_REGISTER || !fixed_regs[REGNO (x)])

HARD_REGISTER_P (x)

> Index: gcc/testsuite/gcc.target/powerpc/cprophard.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/cprophard.c	(revision 0)
> +++ gcc/testsuite/gcc.target/powerpc/cprophard.c	(working copy)
> @@ -0,0 +1,13 @@
> +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */

You can drop the default args:
/* { dg-skip-if "" { powerpc*-*-darwin* } } */

Should you exclude darwin here, anyway?

> +/* { dg-options "-O2" } */
> +/* { dg-final { scan-assembler "ld 2,(24|40)\\(1\\)" } } */

To avoid "toothpick syndrome" you can group with {} instead of "".

Cheers,


Segher



More information about the Gcc-patches mailing list