aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-10-14 11:14:59 +0200
committerRichard Biener <rguenther@suse.de>2022-10-14 12:00:30 +0200
commit9ed4a849afb5b18b462bea311e7eee454c2c9f68 (patch)
tree751e41f4d2918c2d1b561ee04539e8d2de72fe89 /gcc/tree-vect-slp.cc
parente39b170695a161feba7401b7d21d824db9ee1f8f (diff)
downloadgcc-9ed4a849afb5b18b462bea311e7eee454c2c9f68.zip
gcc-9ed4a849afb5b18b462bea311e7eee454c2c9f68.tar.gz
gcc-9ed4a849afb5b18b462bea311e7eee454c2c9f68.tar.bz2
tree-optimization/107254 - check and support live lanes from permutes
The following fixes an omission from adding SLP permute nodes which is live lanes originating from those. We have to check that we can extract the lane and have to actually code generate them. PR tree-optimization/107254 * tree-vect-slp.cc (vect_slp_analyze_node_operations_1): For permutes also analyze live lanes. (vect_schedule_slp_node): For permutes also code generate live lane extracts. * gfortran.dg/vect/pr107254.f90: New testcase.
Diffstat (limited to 'gcc/tree-vect-slp.cc')
-rw-r--r--gcc/tree-vect-slp.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 229f266..af27fd5 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5930,7 +5930,23 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
/* Handle purely internal nodes. */
if (SLP_TREE_CODE (node) == VEC_PERM_EXPR)
- return vectorizable_slp_permutation (vinfo, NULL, node, cost_vec);
+ {
+ if (!vectorizable_slp_permutation (vinfo, NULL, node, cost_vec))
+ return false;
+
+ stmt_vec_info slp_stmt_info;
+ unsigned int i;
+ FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, slp_stmt_info)
+ {
+ if (STMT_VINFO_LIVE_P (slp_stmt_info)
+ && !vectorizable_live_operation (vinfo,
+ slp_stmt_info, NULL, node,
+ node_instance, i,
+ false, cost_vec))
+ return false;
+ }
+ return true;
+ }
gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect);
@@ -8897,8 +8913,6 @@ vect_schedule_slp_node (vec_info *vinfo,
}
}
- bool done_p = false;
-
/* Handle purely internal nodes. */
if (SLP_TREE_CODE (node) == VEC_PERM_EXPR)
{
@@ -8909,9 +8923,18 @@ vect_schedule_slp_node (vec_info *vinfo,
but open-code it here (partly). */
bool done = vectorizable_slp_permutation (vinfo, &si, node, NULL);
gcc_assert (done);
- done_p = true;
+ stmt_vec_info slp_stmt_info;
+ unsigned int i;
+ FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, slp_stmt_info)
+ if (STMT_VINFO_LIVE_P (slp_stmt_info))
+ {
+ done = vectorizable_live_operation (vinfo,
+ slp_stmt_info, &si, node,
+ instance, i, true, NULL);
+ gcc_assert (done);
+ }
}
- if (!done_p)
+ else
vect_transform_stmt (vinfo, stmt_info, &si, node, instance);
}