aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-patterns.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2018-06-30 12:47:25 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2018-06-30 12:47:25 +0000
commit142c320746aa3038df7dd28d5981fe42f969269d (patch)
treeefcd2c3257bda8e25cd2751ce3e03e53029f58a1 /gcc/tree-vect-patterns.c
parentbf8b3614c176fb0aadc51492d672ed531eee0187 (diff)
[9b/n] PR85694: Make vect_is_simple_use look through pattern statements
As suggested by Richard B., this patch makes vect_is_simple_use check whether a defining statement has been replaced by a pattern statement, and if so returns the pattern statement instead. The reason for doing this is that the main patch for PR85694 makes over_widening handle more general cases. These over-widened patterns can still be useful when matching later statements; e.g. an overwidened MULT_EXPR could be the input to a DOT_PROD_EXPR. The patch doesn't do anything with the STMT_VINFO_IN_PATTERN_P checks in vect_recog_over_widening_pattern or vect_recog_widen_shift_pattern since later patches rewrite them anyway. Doing this fixed an XFAIL in vect-reduc-dot-u16b.c. 2018-06-30 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-loop.c (vectorizable_reduction): Assert that the phi is not a pattern statement and has not been replaced by a pattern statement. * tree-vect-patterns.c (type_conversion_p): Don't check STMT_VINFO_IN_PATTERN_P. (vect_recog_vector_vector_shift_pattern): Likewise. (vect_recog_dot_prod_pattern): Expect vect_is_simple_use to return the pattern statement rather than the original statement; check directly for a WIDEN_MULT_EXPR here. * tree-vect-slp.c (vect_get_and_check_slp_defs): Expect vect_is_simple_use to return the pattern statement rather than the original statement; use is_pattern_stmt_p to check for such a pattern statement. * tree-vect-stmts.c (process_use): Expect vect_is_simple_use to return the pattern statement rather than the original statement; don't do the same transformation here. (vect_is_simple_use): If the defining statement has been replaced by a pattern statement, return the pattern statement instead. Remove the corresponding (local) transformation from the vectype overload. gcc/testsuite/ * gcc.dg/vect/vect-reduc-dot-u16b.c: Remove xfail and update the test for vectorization along the lines described in the comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262273 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r--gcc/tree-vect-patterns.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 6fb07fd1265..6926c849f13 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -193,13 +193,6 @@ type_conversion_p (tree name, gimple *use_stmt, bool check_sign,
if (!*def_stmt)
return false;
- if (dt == vect_internal_def)
- {
- stmt_vec_info def_vinfo = vinfo_for_stmt (*def_stmt);
- if (STMT_VINFO_IN_PATTERN_P (def_vinfo))
- return false;
- }
-
if (!is_gimple_assign (*def_stmt))
return false;
@@ -383,20 +376,11 @@ vect_recog_dot_prod_pattern (vec<gimple *> *stmts, tree *type_out)
/* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi
inside the loop (in case we are analyzing an outer-loop). */
gassign *mult = dyn_cast <gassign *> (mult_vinfo->stmt);
- if (!mult || gimple_assign_rhs_code (mult) != MULT_EXPR)
+ if (!mult)
return NULL;
- if (STMT_VINFO_IN_PATTERN_P (mult_vinfo))
+ if (gimple_assign_rhs_code (mult) == WIDEN_MULT_EXPR)
{
/* Has been detected as a widening multiplication? */
-
- mult = dyn_cast <gassign *> (STMT_VINFO_RELATED_STMT (mult_vinfo));
- if (!mult || gimple_assign_rhs_code (mult) != WIDEN_MULT_EXPR)
- return NULL;
- STMT_VINFO_PATTERN_DEF_SEQ (stmt_vinfo)
- = STMT_VINFO_PATTERN_DEF_SEQ (mult_vinfo);
- mult_vinfo = vinfo_for_stmt (mult);
- gcc_assert (mult_vinfo);
- gcc_assert (STMT_VINFO_DEF_TYPE (mult_vinfo) == vect_internal_def);
oprnd00 = gimple_assign_rhs1 (mult);
oprnd01 = gimple_assign_rhs2 (mult);
}
@@ -406,6 +390,9 @@ vect_recog_dot_prod_pattern (vec<gimple *> *stmts, tree *type_out)
gimple *def_stmt;
tree oprnd0, oprnd1;
+ if (gimple_assign_rhs_code (mult) != MULT_EXPR)
+ return NULL;
+
oprnd0 = gimple_assign_rhs1 (mult);
oprnd1 = gimple_assign_rhs2 (mult);
if (!type_conversion_p (oprnd0, mult, true, &half_type0, &def_stmt,
@@ -2050,9 +2037,7 @@ vect_recog_vector_vector_shift_pattern (vec<gimple *> *stmts, tree *type_out)
tree def = NULL_TREE;
gassign *def_stmt = dyn_cast <gassign *> (def_vinfo->stmt);
- if (!STMT_VINFO_IN_PATTERN_P (def_vinfo)
- && def_stmt
- && gimple_assign_cast_p (def_stmt))
+ if (def_stmt && gimple_assign_cast_p (def_stmt))
{
tree rhs1 = gimple_assign_rhs1 (def_stmt);
if (TYPE_MODE (TREE_TYPE (rhs1)) == TYPE_MODE (TREE_TYPE (oprnd0))