+2018-02-26 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/83965
+ * tree-vect-patterns.c (vect_reassociating_reduction_p): Assume
+ that grouped statements are part of a reduction chain. Return
+ true if the statement is not marked as a reduction itself but
+ is part of a group.
+ (vect_recog_dot_prod_pattern): Don't check whether the statement
+ is part of a group here.
+ (vect_recog_sad_pattern): Likewise.
+ (vect_recog_widen_sum_pattern): Likewise.
+
2018-02-26 Eric Botcazou <ebotcazou@adacore.com>
PR debug/84545
+2018-02-26 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/83965
+ * gcc.dg/vect/pr83965-2.c: New test.
+
2018-02-26 Tom de Vries <tom@codesourcery.com>
* gcc.c-torture/compile/regs-arg-size.c (swprintf): Declare.
}
/* Return true if STMT_VINFO describes a reduction for which reassociation
- is allowed. */
+ is allowed. If STMT_INFO is part of a group, assume that it's part of
+ a reduction chain and optimistically assume that all statements
+ except the last allow reassociation. */
static bool
vect_reassociating_reduction_p (stmt_vec_info stmt_vinfo)
{
return (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def
- && STMT_VINFO_REDUC_TYPE (stmt_vinfo) != FOLD_LEFT_REDUCTION);
+ ? STMT_VINFO_REDUC_TYPE (stmt_vinfo) != FOLD_LEFT_REDUCTION
+ : GROUP_FIRST_ELEMENT (stmt_vinfo) != NULL);
}
/* Function vect_recog_dot_prod_pattern
{
gimple *def_stmt;
- if (!vect_reassociating_reduction_p (stmt_vinfo)
- && ! STMT_VINFO_GROUP_FIRST_ELEMENT (stmt_vinfo))
+ if (!vect_reassociating_reduction_p (stmt_vinfo))
return NULL;
oprnd0 = gimple_assign_rhs1 (last_stmt);
oprnd1 = gimple_assign_rhs2 (last_stmt);
{
gimple *def_stmt;
- if (!vect_reassociating_reduction_p (stmt_vinfo)
- && ! STMT_VINFO_GROUP_FIRST_ELEMENT (stmt_vinfo))
+ if (!vect_reassociating_reduction_p (stmt_vinfo))
return NULL;
plus_oprnd0 = gimple_assign_rhs1 (last_stmt);
plus_oprnd1 = gimple_assign_rhs2 (last_stmt);
if (gimple_assign_rhs_code (last_stmt) != PLUS_EXPR)
return NULL;
- if (!vect_reassociating_reduction_p (stmt_vinfo)
- && ! STMT_VINFO_GROUP_FIRST_ELEMENT (stmt_vinfo))
+ if (!vect_reassociating_reduction_p (stmt_vinfo))
return NULL;
oprnd0 = gimple_assign_rhs1 (last_stmt);