From dabec68a1a2cedce988a4ab2d2141f2fee081d5b Mon Sep 17 00:00:00 2001 From: rsandifo Date: Wed, 20 Jun 2018 08:07:37 +0000 Subject: [PATCH] [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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261787 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/tree-vect-patterns.c | 20 -------------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e55c67b9e14..af31f511a3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 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 use the stmt_vec_info of the original bb statement for the new zero assignment, even if the call is part of a pattern. 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 -- 2.11.4.GIT