aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-09-12 11:31:59 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2024-09-12 13:02:23 +0200
commit412c156d78c764d4aec3e94469ba5a4c068cee4c (patch)
tree1f7376c718017263c6203482c26e61f1f089067d
parent44058b847145166715f15e49fa8854f30e852f24 (diff)
downloadgcc-412c156d78c764d4aec3e94469ba5a4c068cee4c.zip
gcc-412c156d78c764d4aec3e94469ba5a4c068cee4c.tar.gz
gcc-412c156d78c764d4aec3e94469ba5a4c068cee4c.tar.bz2
Abort loop SLP analysis quicker
As we can't cope with removed SLP instances during analysis there's no point in doing that or even continuing analysis of SLP instances after a failure. The following makes us abort early. * tree-vect-slp.cc (vect_slp_analyze_operations): When doing loop analysis fail after the first failed SLP instance. Only remove instances when doing BB vectorization. * tree-vect-loop.cc (vect_analyze_loop_2): Check whether vect_slp_analyze_operations failed instead of checking the number of SLP instances remaining.
-rw-r--r--gcc/tree-vect-loop.cc10
-rw-r--r--gcc/tree-vect-slp.cc10
2 files changed, 13 insertions, 7 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 65d7ed5..cc15492 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2947,12 +2947,10 @@ start_over:
if (slp)
{
- /* Analyze operations in the SLP instances. Note this may
- remove unsupported SLP instances which makes the above
- SLP kind detection invalid. */
- unsigned old_size = LOOP_VINFO_SLP_INSTANCES (loop_vinfo).length ();
- vect_slp_analyze_operations (loop_vinfo);
- if (LOOP_VINFO_SLP_INSTANCES (loop_vinfo).length () != old_size)
+ /* Analyze operations in the SLP instances. We can't simply
+ remove unsupported SLP instances as this makes the above
+ SLP kind detection invalid and might also affect the VF. */
+ if (! vect_slp_analyze_operations (loop_vinfo))
{
ok = opt_result::failure_at (vect_location,
"unsupported SLP instances\n");
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 975949c..4fcb9e2 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -7976,19 +7976,27 @@ vect_slp_analyze_operations (vec_info *vinfo)
|| (SLP_INSTANCE_KIND (instance) == slp_inst_kind_bb_reduc
&& !vectorizable_bb_reduc_epilogue (instance, &cost_vec)))
{
+ cost_vec.release ();
slp_tree node = SLP_INSTANCE_TREE (instance);
stmt_vec_info stmt_info;
if (!SLP_INSTANCE_ROOT_STMTS (instance).is_empty ())
stmt_info = SLP_INSTANCE_ROOT_STMTS (instance)[0];
else
stmt_info = SLP_TREE_SCALAR_STMTS (node)[0];
+ if (is_a <loop_vec_info> (vinfo))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "unsupported SLP instance starting from: %G",
+ stmt_info->stmt);
+ return false;
+ }
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"removing SLP instance operations starting from: %G",
stmt_info->stmt);
vect_free_slp_instance (instance);
vinfo->slp_instances.ordered_remove (i);
- cost_vec.release ();
while (!visited_vec.is_empty ())
visited.remove (visited_vec.pop ());
}