Patchwork Fix combine.c (count_rtxs) (PR middle-end/54879)

login
register
mail settings
Submitter Jakub Jelinek
Date Oct. 10, 2012, 6:46 a.m.
Message ID <20121010064642.GM26735@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/190568/
State New
Headers show

Comments

Jakub Jelinek - Oct. 10, 2012, 6:46 a.m.
Hi!

Seems I wrote a patch 7.5 years ago for and on the 3.4 branch
(supposedly for a testcase that went latent on the trunk at that time,
due to SSA merge?), and missed the fact that GET_RTX_CLASS changed
on the trunk from characters to enum.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2012-10-10  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/54879
	* combine.c (count_rtxs): Use RTX_BIN_ARITH resp. RTX_COMM_ARITH
	instead of '2' resp. 'c' for GET_RTX_CLASS comparisons.


	Jakub
Richard Guenther - Oct. 10, 2012, 8:32 a.m.
On Wed, Oct 10, 2012 at 8:46 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> Seems I wrote a patch 7.5 years ago for and on the 3.4 branch
> (supposedly for a testcase that went latent on the trunk at that time,
> due to SSA merge?), and missed the fact that GET_RTX_CLASS changed
> on the trunk from characters to enum.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

Yes, that's obvious.

Thanks,
Richard.

> 2012-10-10  Jakub Jelinek  <jakub@redhat.com>
>
>         PR middle-end/54879
>         * combine.c (count_rtxs): Use RTX_BIN_ARITH resp. RTX_COMM_ARITH
>         instead of '2' resp. 'c' for GET_RTX_CLASS comparisons.
>
> --- gcc/combine.c.jj    2012-09-27 12:45:55.000000000 +0200
> +++ gcc/combine.c       2012-10-09 23:35:17.577659296 +0200
> @@ -12015,8 +12015,8 @@ count_rtxs (rtx x)
>    const char *fmt;
>    int i, j, ret = 1;
>
> -  if (GET_RTX_CLASS (code) == '2'
> -      || GET_RTX_CLASS (code) == 'c')
> +  if (GET_RTX_CLASS (code) == RTX_BIN_ARITH
> +      || GET_RTX_CLASS (code) == RTX_COMM_ARITH)
>      {
>        rtx x0 = XEXP (x, 0);
>        rtx x1 = XEXP (x, 1);
> @@ -12024,15 +12024,15 @@ count_rtxs (rtx x)
>        if (x0 == x1)
>         return 1 + 2 * count_rtxs (x0);
>
> -      if ((GET_RTX_CLASS (GET_CODE (x1)) == '2'
> -          || GET_RTX_CLASS (GET_CODE (x1)) == 'c')
> +      if ((GET_RTX_CLASS (GET_CODE (x1)) == RTX_BIN_ARITH
> +          || GET_RTX_CLASS (GET_CODE (x1)) == RTX_COMM_ARITH)
>           && (x0 == XEXP (x1, 0) || x0 == XEXP (x1, 1)))
>         return 2 + 2 * count_rtxs (x0)
>                + count_rtxs (x == XEXP (x1, 0)
>                              ? XEXP (x1, 1) : XEXP (x1, 0));
>
> -      if ((GET_RTX_CLASS (GET_CODE (x0)) == '2'
> -          || GET_RTX_CLASS (GET_CODE (x0)) == 'c')
> +      if ((GET_RTX_CLASS (GET_CODE (x0)) == RTX_BIN_ARITH
> +          || GET_RTX_CLASS (GET_CODE (x0)) == RTX_COMM_ARITH)
>           && (x1 == XEXP (x0, 0) || x1 == XEXP (x0, 1)))
>         return 2 + 2 * count_rtxs (x1)
>                + count_rtxs (x == XEXP (x0, 0)
>
>         Jakub

Patch

--- gcc/combine.c.jj	2012-09-27 12:45:55.000000000 +0200
+++ gcc/combine.c	2012-10-09 23:35:17.577659296 +0200
@@ -12015,8 +12015,8 @@  count_rtxs (rtx x)
   const char *fmt;
   int i, j, ret = 1;
 
-  if (GET_RTX_CLASS (code) == '2'
-      || GET_RTX_CLASS (code) == 'c')
+  if (GET_RTX_CLASS (code) == RTX_BIN_ARITH
+      || GET_RTX_CLASS (code) == RTX_COMM_ARITH)
     {
       rtx x0 = XEXP (x, 0);
       rtx x1 = XEXP (x, 1);
@@ -12024,15 +12024,15 @@  count_rtxs (rtx x)
       if (x0 == x1)
 	return 1 + 2 * count_rtxs (x0);
 
-      if ((GET_RTX_CLASS (GET_CODE (x1)) == '2'
-	   || GET_RTX_CLASS (GET_CODE (x1)) == 'c')
+      if ((GET_RTX_CLASS (GET_CODE (x1)) == RTX_BIN_ARITH
+	   || GET_RTX_CLASS (GET_CODE (x1)) == RTX_COMM_ARITH)
 	  && (x0 == XEXP (x1, 0) || x0 == XEXP (x1, 1)))
 	return 2 + 2 * count_rtxs (x0)
 	       + count_rtxs (x == XEXP (x1, 0)
 			     ? XEXP (x1, 1) : XEXP (x1, 0));
 
-      if ((GET_RTX_CLASS (GET_CODE (x0)) == '2'
-	   || GET_RTX_CLASS (GET_CODE (x0)) == 'c')
+      if ((GET_RTX_CLASS (GET_CODE (x0)) == RTX_BIN_ARITH
+	   || GET_RTX_CLASS (GET_CODE (x0)) == RTX_COMM_ARITH)
 	  && (x1 == XEXP (x0, 0) || x1 == XEXP (x0, 1)))
 	return 2 + 2 * count_rtxs (x1)
 	       + count_rtxs (x == XEXP (x0, 0)