aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-02-22 10:50:12 +0100
committerRichard Biener <rguenther@suse.de>2024-02-22 13:13:48 +0100
commit549f251f055e3a0b0084189a3012c4f15d635e75 (patch)
treee920c24546d657aa006b7cb03c5ba1dc9f96cabd /gcc/tree-vect-loop.cc
parenta0782531b8270f0fdb3f3e09b4ce544d5d1eef14 (diff)
downloadgcc-549f251f055e3a0b0084189a3012c4f15d635e75.zip
gcc-549f251f055e3a0b0084189a3012c4f15d635e75.tar.gz
gcc-549f251f055e3a0b0084189a3012c4f15d635e75.tar.bz2
tree-optimization/114027 - conditional reduction chain
When we classify a conditional reduction chain as CONST_COND_REDUCTION we fail to verify all involved conditionals have the same constant. That's a quite unlikely situation so the following simply disables such classification when there's more than one reduction statement. PR tree-optimization/114027 * tree-vect-loop.cc (vecctorizable_reduction): Use optimized condition reduction classification only for single-element chains. * gcc.dg/vect/pr114027.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 5a5865c..35f1f8c 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7759,17 +7759,18 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
< GET_MODE_SIZE (SCALAR_TYPE_MODE (TREE_TYPE (vectype_op[i]))))))
vectype_in = vectype_op[i];
- if (op.code == COND_EXPR)
+ /* Record how the non-reduction-def value of COND_EXPR is defined.
+ ??? For a chain of multiple CONDs we'd have to match them up all. */
+ if (op.code == COND_EXPR && reduc_chain_length == 1)
{
- /* Record how the non-reduction-def value of COND_EXPR is defined. */
if (dt == vect_constant_def)
{
cond_reduc_dt = dt;
cond_reduc_val = op.ops[i];
}
- if (dt == vect_induction_def
- && def_stmt_info
- && is_nonwrapping_integer_induction (def_stmt_info, loop))
+ else if (dt == vect_induction_def
+ && def_stmt_info
+ && is_nonwrapping_integer_induction (def_stmt_info, loop))
{
cond_reduc_dt = dt;
cond_stmt_vinfo = def_stmt_info;