aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-03-11 14:58:57 +0100
committerRichard Biener <rguenther@suse.de>2024-03-12 08:16:56 +0100
commitc0c57246d5b47459bdb488734bc2c004a92668b5 (patch)
treeecf6b510c738c2cf3daf9221be24b1f624a0b66f /gcc/tree-vect-loop.cc
parentc4e5789cede6974b6483c0f82069ff80b5a547e4 (diff)
downloadgcc-c0c57246d5b47459bdb488734bc2c004a92668b5.zip
gcc-c0c57246d5b47459bdb488734bc2c004a92668b5.tar.gz
gcc-c0c57246d5b47459bdb488734bc2c004a92668b5.tar.bz2
tree-optimization/114297 - SLP reduction with early break fix
The following makes sure to pass in the SLP node for the live stmts we are generating the reduction epilogue for to vect_create_epilog_for_reduction. This follows the previous fix for the non-SLP path. PR tree-optimization/114297 * tree-vect-loop.cc (vectorizable_live_operation): Pass in the live stmts SLP node to vect_create_epilog_for_reduction. * gcc.dg/vect/vect-early-break_123-pr114297.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 20ee0aa..4375ebd 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -10729,17 +10729,18 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info,
block, but we have to find an alternate exit first. */
if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
{
+ slp_tree phis_node = slp_node ? slp_node_instance->reduc_phis : NULL;
for (auto exit : get_loop_exit_edges (LOOP_VINFO_LOOP (loop_vinfo)))
if (exit != LOOP_VINFO_IV_EXIT (loop_vinfo))
{
vect_create_epilog_for_reduction (loop_vinfo, reduc_info,
- slp_node, slp_node_instance,
+ phis_node, slp_node_instance,
exit);
break;
}
if (LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo))
- vect_create_epilog_for_reduction (loop_vinfo, reduc_info, slp_node,
- slp_node_instance,
+ vect_create_epilog_for_reduction (loop_vinfo, reduc_info,
+ phis_node, slp_node_instance,
LOOP_VINFO_IV_EXIT (loop_vinfo));
}