This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] genmatch fix (PR tree-optimization/71563)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Dec 2016 22:18:34 +0100
- Subject: [PATCH] genmatch fix (PR tree-optimization/71563)
- Authentication-results: sourceware.org; auth=none
- References: <20161220190933.GO21933@tucnak> <alpine.DEB.2.20.1612202116420.2423@laptop-mg.saclay.inria.fr> <20161220204503.GP21933@tucnak>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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