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.
Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard 2018-06-18 Richard Sandiford <richard.sandif...@arm.com> 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. Index: gcc/tree-vect-patterns.c =================================================================== --- gcc/tree-vect-patterns.c 2018-06-18 15:24:21.001379616 +0100 +++ gcc/tree-vect-patterns.c 2018-06-18 15:24:49.829125450 +0100 @@ -358,9 +358,6 @@ vect_recog_dot_prod_pattern (vec<gimple 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<gimple 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<gimple *> *s 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<gimple *> *s 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<gimple *> *s 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<gimpl 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<gimple 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