Patchwork allowing fwprop to propagate subregs

login
register
mail settings
Submitter Ulrich Weigand
Date March 19, 2012, 4:07 p.m.
Message ID <201203191607.q2JG7WNl021730@d06av02.portsmouth.uk.ibm.com>
Download mbox | patch
Permalink /patch/147566/
State New
Headers show

Comments

Ulrich Weigand - March 19, 2012, 4:07 p.m.
Hello,

now that the apply_distributive_law change is in, I'd like to pick up
Richard's original patch, see discussion here:
http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00852.html

The version below integrates all requests for changes that were raised.
It's been part of Linaro GCC releases in this form for a while with no
problem reported.  We see performance improvements in several libav loops,
as described in Richard's original mail.  We've seen no test case so far
where this patch (against current baseline) has shown any significant
performance regressions.

Re-tested on arm-linux-gnueabi and i386-linux-gnu with no regressions.

OK for mainline?

Bye,
Ulrich


ChangeLog:

	* fwprop.c (propagate_rtx): Also set PR_CAN_APPEAR for subregs.
Paolo Bonzini - March 19, 2012, 4:34 p.m.
Il 19/03/2012 17:07, Ulrich Weigand ha scritto:
> Hello,
> 
> now that the apply_distributive_law change is in, I'd like to pick up
> Richard's original patch, see discussion here:
> http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00852.html
> 
> The version below integrates all requests for changes that were raised.
> It's been part of Linaro GCC releases in this form for a while with no
> problem reported.  We see performance improvements in several libav loops,
> as described in Richard's original mail.  We've seen no test case so far
> where this patch (against current baseline) has shown any significant
> performance regressions.
> 
> Re-tested on arm-linux-gnueabi and i386-linux-gnu with no regressions.
> 
> OK for mainline?
> 
> Bye,
> Ulrich
> 
> 
> ChangeLog:
> 
> 	* fwprop.c (propagate_rtx): Also set PR_CAN_APPEAR for subregs.
> 
> === modified file 'gcc/fwprop.c'
> --- gcc/fwprop.c	2011-12-19 22:05:28 +0000
> +++ gcc/fwprop.c	2012-02-22 11:57:19 +0000
> @@ -664,7 +664,12 @@
>      return NULL_RTX;
>  
>    flags = 0;
> -  if (REG_P (new_rtx) || CONSTANT_P (new_rtx))
> +  if (REG_P (new_rtx)
> +      || CONSTANT_P (new_rtx)
> +      || (GET_CODE (new_rtx) == SUBREG
> +	  && REG_P (SUBREG_REG (new_rtx))
> +	  && (GET_MODE_SIZE (mode)
> +	      <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (new_rtx))))))
>      flags |= PR_CAN_APPEAR;
>    if (!for_each_rtx (&new_rtx, varying_mem_p, NULL))
>      flags |= PR_HANDLE_MEM;
> 

I cannot approve it, but it looks good.

Paolo
Richard Sandiford - April 10, 2012, 1:42 p.m.
"Ulrich Weigand" <uweigand@de.ibm.com> writes:
> http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01269.html

I don't like approving patches I had a hand in, but since Paolo
was happy, and since no-one else seems to care... OK.  Thanks for
getting this working.

Richard

Patch

=== modified file 'gcc/fwprop.c'
--- gcc/fwprop.c	2011-12-19 22:05:28 +0000
+++ gcc/fwprop.c	2012-02-22 11:57:19 +0000
@@ -664,7 +664,12 @@ 
     return NULL_RTX;
 
   flags = 0;
-  if (REG_P (new_rtx) || CONSTANT_P (new_rtx))
+  if (REG_P (new_rtx)
+      || CONSTANT_P (new_rtx)
+      || (GET_CODE (new_rtx) == SUBREG
+	  && REG_P (SUBREG_REG (new_rtx))
+	  && (GET_MODE_SIZE (mode)
+	      <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (new_rtx))))))
     flags |= PR_CAN_APPEAR;
   if (!for_each_rtx (&new_rtx, varying_mem_p, NULL))
     flags |= PR_HANDLE_MEM;