[PATCH] genmatch fix (PR tree-optimization/71563)

Jakub Jelinek jakub@redhat.com
Thu Dec 29 21:20:00 GMT 2016


Hi!

On Tue, Dec 20, 2016 at 09:45:03PM +0100, Jakub Jelinek wrote:
> That is what I tried first, but there is some bug in genmatch.c that
> prevents it.  The:
>  (for vec (VECTOR_CST CONSTRUCTOR)
>   (simplify
>    (shiftrotate @0 vec@1)
> results in case SSA_NAME: being added to a switch:
>     case SSA_NAME:
>       if (do_valueize (valueize, op1) != NULL_TREE)
>         {
>           gimple *def_stmt = SSA_NAME_DEF_STMT (op1);
>           if (gassign *def = dyn_cast <gassign *> (def_stmt))
>             switch (gimple_assign_rhs_code (def))
>               {
>               case CONSTRUCTOR:
> and the SSA_NAME@1 in another simplification resulted in another
>     case SSA_NAME:
> into the same switch (rather than appending to the case SSA_NAME).

This patch attempts to deal with that.  The change for the new version of
the patch with SSA_NAME@1 I'll post right away is (twice).  Two case SSA_NAME:
in a single switch of course don't work well.

--- gimple-match.c.jj   2016-12-29 21:57:22.000000000 +0100
+++ gimple-match.c      2016-12-29 22:11:58.824526121 +0100
@@ -63732,6 +63732,14 @@ if (integer_all_onesp (op0))
              default:;
              }
         }
+       {
+         {
+/* #line 1524 "../../gcc/match.pd" */
+           tree captures[2] ATTRIBUTE_UNUSED = { op0, op1 };
+           if (gimple_simplify_79 (res_code, res_ops, seq, valueize, type, captures, RSHIFT_EXPR))
+             return true;
+         }
+       }
       break;
     case VECTOR_CST:
       {
@@ -63743,16 +63751,6 @@ if (integer_all_onesp (op0))
        }
         break;
       }
-    case SSA_NAME:
-      {
-       {
-/* #line 1524 "../../gcc/match.pd" */
-         tree captures[2] ATTRIBUTE_UNUSED = { op0, op1 };
-         if (gimple_simplify_79 (res_code, res_ops, seq, valueize, type, captures, RSHIFT_EXPR))
-           return true;
-       }
-        break;
-      }
     default:;
     }
   switch (TREE_CODE (op0))


	Jakub



More information about the Gcc-patches mailing list