This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]