diff options
author | Richard Biener <rguenther@suse.de> | 2025-01-07 11:15:43 +0100 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-01-08 08:21:50 +0100 |
commit | 2dd4eb15b63ca1f20a637e8b26567d5064a43a4f (patch) | |
tree | 9b6961ead5b7adb14b84ed05535cb4345a1473bd /gcc/tree-vect-loop.cc | |
parent | 42b24557bdf805d2913d3c75531fe441b1634332 (diff) | |
download | gcc-2dd4eb15b63ca1f20a637e8b26567d5064a43a4f.zip gcc-2dd4eb15b63ca1f20a637e8b26567d5064a43a4f.tar.gz gcc-2dd4eb15b63ca1f20a637e8b26567d5064a43a4f.tar.bz2 |
tree-optimization/118269 - SLP reduction chain and early breaks
When we create the SLP reduction chain epilogue for the PHIs for
the early exit we fail to properly classify the reduction as SLP
reduction chain. The following fixes the corresponding checks.
PR tree-optimization/118269
* tree-vect-loop.cc (vect_create_epilog_for_reduction):
Use the correct stmt for the REDUC_GROUP_FIRST_ELEMENT lookup.
* gcc.dg/vect/vect-early-break_131-pr118269.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r-- | gcc/tree-vect-loop.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 2b9d595..bb1138b 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -6039,7 +6039,9 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, # b1 = phi <b2, b0> a2 = operation (a1) b2 = operation (b1) */ - bool slp_reduc = (slp_node && !REDUC_GROUP_FIRST_ELEMENT (stmt_info)); + bool slp_reduc + = (slp_node + && !REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info))); bool direct_slp_reduc; tree induction_index = NULL_TREE; @@ -6331,7 +6333,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, a multiple of the SLP group size. The same is true if we couldn't use a single defuse cycle. */ - if (REDUC_GROUP_FIRST_ELEMENT (stmt_info) + if (REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info)) || direct_slp_reduc || (slp_reduc && constant_multiple_p (TYPE_VECTOR_SUBPARTS (vectype), group_size)) @@ -6632,7 +6634,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, if (slp_node) { tree initial_value = NULL_TREE; - if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)) + if (REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info))) initial_value = reduc_info->reduc_initial_values[0]; neutral_op = neutral_op_for_reduction (TREE_TYPE (vectype), code, initial_value, false); |