aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-06-20 08:08:21 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-06-20 08:08:21 +0000
commit1f78617090283f22825807fcc0533e27e983dcde (patch)
tree48e8724f13b0e0b6cd85144671a09044ac4a7a0c /gcc
parent44ae7a002c23ff0ab884350b5f05876ece985387 (diff)
downloadgcc-1f78617090283f22825807fcc0533e27e983dcde.zip
gcc-1f78617090283f22825807fcc0533e27e983dcde.tar.gz
gcc-1f78617090283f22825807fcc0533e27e983dcde.tar.bz2
[5/n] PR85694: Remove dead WIDEN_SUM handling
vect_recog_dot_prod_pattern and vect_recog_sad_pattern both checked whether the statement passed in had already been recognised as a WIDEN_SUM_EXPR pattern. That isn't possible (any more?), since the first recognised pattern wins, and since vect_recog_widen_sum_pattern never matches a later statement than the one it's given. 2018-06-20 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Remove redundant WIDEN_SUM_EXPR handling. (vect_recog_sad_pattern): Likewise. From-SVN: r261788
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-vect-patterns.c83
2 files changed, 35 insertions, 54 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af31f51..aaf80f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,12 @@
2018-06-20 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Remove
+ redundant WIDEN_SUM_EXPR handling.
+ (vect_recog_sad_pattern): Likewise.
+
+2018-06-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Remove
redundant check that the types of a PLUS_EXPR or MULT_EXPR agree.
(vect_recog_sad_pattern): Likewise PLUS_EXPR, ABS_EXPR and MINUS_EXPR.
(vect_recog_widen_mult_pattern): Likewise MULT_EXPR.
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 2387a8e..b6cb6e3 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -339,37 +339,25 @@ vect_recog_dot_prod_pattern (vec<gimple *> *stmts, tree *type_in,
return NULL;
if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo))
- {
- /* Has been detected as widening-summation? */
+ return NULL;
- stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo);
- type = gimple_expr_type (stmt);
- if (gimple_assign_rhs_code (stmt) != WIDEN_SUM_EXPR)
- return NULL;
- oprnd0 = gimple_assign_rhs1 (stmt);
- oprnd1 = gimple_assign_rhs2 (stmt);
- half_type = TREE_TYPE (oprnd0);
- }
- else
- {
- gimple *def_stmt;
+ if (!vect_reassociating_reduction_p (stmt_vinfo))
+ return NULL;
- if (!vect_reassociating_reduction_p (stmt_vinfo))
- return NULL;
- oprnd0 = gimple_assign_rhs1 (last_stmt);
- oprnd1 = gimple_assign_rhs2 (last_stmt);
- stmt = last_stmt;
+ oprnd0 = gimple_assign_rhs1 (last_stmt);
+ oprnd1 = gimple_assign_rhs2 (last_stmt);
+ stmt = last_stmt;
- if (type_conversion_p (oprnd0, stmt, true, &half_type, &def_stmt,
- &promotion)
- && promotion)
- {
- stmt = def_stmt;
- oprnd0 = gimple_assign_rhs1 (stmt);
- }
- else
- half_type = type;
+ gimple *def_stmt;
+ if (type_conversion_p (oprnd0, stmt, true, &half_type, &def_stmt,
+ &promotion)
+ && promotion)
+ {
+ stmt = def_stmt;
+ oprnd0 = gimple_assign_rhs1 (stmt);
}
+ else
+ half_type = type;
/* So far so good. Since last_stmt was detected as a (summation) reduction,
we know that oprnd1 is the reduction variable (defined by a loop-header
@@ -553,34 +541,22 @@ vect_recog_sad_pattern (vec<gimple *> *stmts, tree *type_in,
tree plus_oprnd0, plus_oprnd1;
if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo))
- {
- /* Has been detected as widening-summation? */
+ return NULL;
- gimple *stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo);
- sum_type = gimple_expr_type (stmt);
- if (gimple_assign_rhs_code (stmt) != WIDEN_SUM_EXPR)
- return NULL;
- plus_oprnd0 = gimple_assign_rhs1 (stmt);
- plus_oprnd1 = gimple_assign_rhs2 (stmt);
- half_type = TREE_TYPE (plus_oprnd0);
- }
- else
- {
- gimple *def_stmt;
+ if (!vect_reassociating_reduction_p (stmt_vinfo))
+ return NULL;
- if (!vect_reassociating_reduction_p (stmt_vinfo))
- return NULL;
- plus_oprnd0 = gimple_assign_rhs1 (last_stmt);
- plus_oprnd1 = gimple_assign_rhs2 (last_stmt);
-
- /* The type conversion could be promotion, demotion,
- or just signed -> unsigned. */
- if (type_conversion_p (plus_oprnd0, last_stmt, false,
- &half_type, &def_stmt, &promotion))
- plus_oprnd0 = gimple_assign_rhs1 (def_stmt);
- else
- half_type = sum_type;
- }
+ plus_oprnd0 = gimple_assign_rhs1 (last_stmt);
+ plus_oprnd1 = gimple_assign_rhs2 (last_stmt);
+
+ /* The type conversion could be promotion, demotion,
+ or just signed -> unsigned. */
+ gimple *def_stmt;
+ if (type_conversion_p (plus_oprnd0, last_stmt, false,
+ &half_type, &def_stmt, &promotion))
+ plus_oprnd0 = gimple_assign_rhs1 (def_stmt);
+ else
+ half_type = sum_type;
/* So far so good. Since last_stmt was detected as a (summation) reduction,
we know that plus_oprnd1 is the reduction variable (defined by a loop-header
@@ -639,7 +615,6 @@ vect_recog_sad_pattern (vec<gimple *> *stmts, tree *type_in,
return NULL;
tree half_type0, half_type1;
- gimple *def_stmt;
tree minus_oprnd0 = gimple_assign_rhs1 (diff_stmt);
tree minus_oprnd1 = gimple_assign_rhs2 (diff_stmt);