From: Richard Sandiford Date: Wed, 20 Jun 2018 08:07:37 +0000 (+0000) Subject: [4/n] PR85694: Remove redundant calls to types_compatible_p X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44ae7a002c23ff0ab884350b5f05876ece985387;p=gcc.git [4/n] PR85694: Remove redundant calls to types_compatible_p tree-vect-patterns.c checked that operands to primitive arithmetic ops are compatible with each other and with the result. The checks date back years and have long been redundant with verify_gimple_stmt. 2018-06-20 Richard Sandiford gcc/ * 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. (vect_recog_widen_sum_pattern): Likewise PLUS_EXPR. From-SVN: r261787 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e55c67b9e14..af31f511a3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-06-20 Richard Sandiford + + * 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. + (vect_recog_widen_sum_pattern): Likewise PLUS_EXPR. + 2018-06-20 Richard Sandiford * tree-vect-stmts.c (vectorizable_call): Make sure that we diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 5d0543f05d0..2387a8e1053 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -358,9 +358,6 @@ vect_recog_dot_prod_pattern (vec *stmts, tree *type_in, return NULL; oprnd0 = gimple_assign_rhs1 (last_stmt); oprnd1 = gimple_assign_rhs2 (last_stmt); - if (!types_compatible_p (TREE_TYPE (oprnd0), type) - || !types_compatible_p (TREE_TYPE (oprnd1), type)) - return NULL; stmt = last_stmt; if (type_conversion_p (oprnd0, stmt, true, &half_type, &def_stmt, @@ -421,9 +418,6 @@ vect_recog_dot_prod_pattern (vec *stmts, tree *type_in, oprnd0 = gimple_assign_rhs1 (stmt); oprnd1 = gimple_assign_rhs2 (stmt); - if (!types_compatible_p (TREE_TYPE (oprnd0), prod_type) - || !types_compatible_p (TREE_TYPE (oprnd1), prod_type)) - return NULL; if (!type_conversion_p (oprnd0, stmt, true, &half_type0, &def_stmt, &promotion) || !promotion) @@ -578,9 +572,6 @@ vect_recog_sad_pattern (vec *stmts, tree *type_in, return NULL; plus_oprnd0 = gimple_assign_rhs1 (last_stmt); plus_oprnd1 = gimple_assign_rhs2 (last_stmt); - if (!types_compatible_p (TREE_TYPE (plus_oprnd0), sum_type) - || !types_compatible_p (TREE_TYPE (plus_oprnd1), sum_type)) - return NULL; /* The type conversion could be promotion, demotion, or just signed -> unsigned. */ @@ -620,8 +611,6 @@ vect_recog_sad_pattern (vec *stmts, tree *type_in, return NULL; tree abs_oprnd = gimple_assign_rhs1 (abs_stmt); - if (!types_compatible_p (TREE_TYPE (abs_oprnd), abs_type)) - return NULL; if (TYPE_UNSIGNED (abs_type)) return NULL; @@ -655,9 +644,6 @@ vect_recog_sad_pattern (vec *stmts, tree *type_in, tree minus_oprnd0 = gimple_assign_rhs1 (diff_stmt); tree minus_oprnd1 = gimple_assign_rhs2 (diff_stmt); - if (!types_compatible_p (TREE_TYPE (minus_oprnd0), abs_type) - || !types_compatible_p (TREE_TYPE (minus_oprnd1), abs_type)) - return NULL; if (!type_conversion_p (minus_oprnd0, diff_stmt, false, &half_type0, &def_stmt, &promotion) || !promotion) @@ -862,9 +848,6 @@ vect_recog_widen_mult_pattern (vec *stmts, oprnd0 = gimple_assign_rhs1 (last_stmt); oprnd1 = gimple_assign_rhs2 (last_stmt); - if (!types_compatible_p (TREE_TYPE (oprnd0), type) - || !types_compatible_p (TREE_TYPE (oprnd1), type)) - return NULL; /* Check argument 0. */ if (!type_conversion_p (oprnd0, last_stmt, false, &half_type0, &def_stmt0, @@ -1264,9 +1247,6 @@ vect_recog_widen_sum_pattern (vec *stmts, tree *type_in, oprnd0 = gimple_assign_rhs1 (last_stmt); oprnd1 = gimple_assign_rhs2 (last_stmt); - if (!types_compatible_p (TREE_TYPE (oprnd0), type) - || !types_compatible_p (TREE_TYPE (oprnd1), type)) - return NULL; /* 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