[gcc r17-2221] Remove group_size argument from vect_built_slp_tree* APIs

Richard Biener via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:b026344b5e7bbffc9433e16ebb84ca7e14957c6a

commit r17-2221-gb026344b5e7bbffc9433e16ebb84ca7e14957c6a
Author: Richard Biener <[email protected]>
Date:   Wed Jul 8 14:25:08 2026 +0200

    Remove group_size argument from vect_built_slp_tree* APIs
    
    The group_size argument is redundant with the stmt vector length.
    
            * tree-vect-slp.cc (vect_build_slp_tree_1): Remove group_size
            argument and adjust.
            (vect_build_slp_tree_2): Likewise.
            (vect_build_slp_tree): Likewise.
            (optimize_load_redistribution_1): Likewise.
            (vect_build_slp_instance): Likewise.
            (vect_analyze_slp_reduc_chain): Likewise.
            (vect_analyze_slp_reduction): Likewise.
            (vect_analyze_slp_reduction_group): Likewise.
            (vect_analyze_slp_instance): Likewise.
            (vect_lower_load_permutations): Likewise.

Diff:
---
 gcc/tree-vect-slp.cc | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 0266e75888c0..ff11b392305d 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1147,10 +1147,11 @@ vect_record_max_nunits (vec_info *vinfo, stmt_vec_info stmt_info,
 
 static bool
 vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
-		       vec<stmt_vec_info> stmts, unsigned int group_size,
+		       vec<stmt_vec_info> stmts,
 		       poly_uint64 *max_nunits, bool *matches,
 		       bool *two_operators, tree *node_vectype)
 {
+  unsigned int group_size = stmts.length ();
   unsigned int i;
   stmt_vec_info first_stmt_info = stmts[0];
   code_helper first_stmt_code = ERROR_MARK;
@@ -1881,18 +1882,19 @@ static unsigned least_upthread_swappable_op_distance = -1U;
 
 static slp_tree
 vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
-		       vec<stmt_vec_info> stmts, unsigned int group_size,
+		       vec<stmt_vec_info> stmts,
 		       poly_uint64 *max_nunits,
 		       bool *matches, unsigned *limit, unsigned *tree_size,
 		       scalar_stmts_to_slp_tree_map_t *bst_map);
 
 static slp_tree
 vect_build_slp_tree (vec_info *vinfo,
-		     vec<stmt_vec_info> stmts, unsigned int group_size,
+		     vec<stmt_vec_info> stmts,
 		     poly_uint64 *max_nunits,
 		     bool *matches, unsigned *limit, unsigned *tree_size,
 		     scalar_stmts_to_slp_tree_map_t *bst_map)
 {
+  unsigned int group_size = stmts.length ();
   if (slp_tree *leader = bst_map->get (stmts))
     {
       if (dump_enabled_p ())
@@ -1937,7 +1939,7 @@ vect_build_slp_tree (vec_info *vinfo,
 		     "starting SLP discovery for node %p\n", (void *) res);
 
   poly_uint64 this_max_nunits = 1;
-  slp_tree res_ = vect_build_slp_tree_2 (vinfo, res, stmts, group_size,
+  slp_tree res_ = vect_build_slp_tree_2 (vinfo, res, stmts,
 					&this_max_nunits,
 					matches, limit, tree_size, bst_map);
   if (!res_)
@@ -2025,11 +2027,12 @@ vect_slp_build_two_operator_nodes (slp_tree perm, tree vectype,
 
 static slp_tree
 vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
-		       vec<stmt_vec_info> stmts, unsigned int group_size,
+		       vec<stmt_vec_info> stmts,
 		       poly_uint64 *max_nunits,
 		       bool *matches, unsigned *limit, unsigned *tree_size,
 		       scalar_stmts_to_slp_tree_map_t *bst_map)
 {
+  unsigned int group_size = stmts.length ();
   unsigned nops, i, this_tree_size = 0;
   poly_uint64 this_max_nunits = *max_nunits;
 
@@ -2108,7 +2111,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
   bool two_operators = false;
   unsigned char *swap = XALLOCAVEC (unsigned char, group_size);
   tree vectype = NULL_TREE;
-  if (!vect_build_slp_tree_1 (vinfo, swap, stmts, group_size,
+  if (!vect_build_slp_tree_1 (vinfo, swap, stmts,
 			      &this_max_nunits, matches, &two_operators,
 			      &vectype))
     return NULL;
@@ -2205,7 +2208,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
 		    }
 		  bool *matches2 = XALLOCAVEC (bool, dr_group_size);
 		  slp_tree unperm_load
-		    = vect_build_slp_tree (vinfo, stmts2, dr_group_size,
+		    = vect_build_slp_tree (vinfo, stmts2,
 					   &this_max_nunits, matches2, limit,
 					   &this_tree_size, bst_map);
 		  /* When we are able to do the full masked load emit that
@@ -2509,7 +2512,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
 			else
 			  op_stmts.quick_push (NULL);
 		      child = vect_build_slp_tree (vinfo, op_stmts,
-						   group_size, &this_max_nunits,
+						   &this_max_nunits,
 						   matches, limit,
 						   &this_tree_size, bst_map);
 		      /* ???  We're likely getting too many fatal mismatches
@@ -2947,7 +2950,7 @@ out:
 	  vec<stmt_vec_info> def_stmts2;
 	  def_stmts2.create (1);
 	  def_stmts2.quick_push (oprnd_info->def_stmts[0]);
-	  child = vect_build_slp_tree (vinfo, def_stmts2, 1,
+	  child = vect_build_slp_tree (vinfo, def_stmts2,
 				       &this_max_nunits,
 				       matches, limit,
 				       &this_tree_size, bst_map);
@@ -3021,7 +3024,7 @@ out:
       else if (least_upthread_swappable_op_distance != -1U)
 	least_upthread_swappable_op_distance++;
       child = vect_build_slp_tree (vinfo, oprnd_info->def_stmts,
-				   group_size, &this_max_nunits,
+				   &this_max_nunits,
 				   matches, limit,
 				   &this_tree_size, bst_map);
       least_upthread_swappable_op_distance = old_swap_distance;
@@ -3083,7 +3086,7 @@ out:
 	  /* And try again with scratch 'matches' ... */
 	  bool *tem = XALLOCAVEC (bool, group_size);
 	  if ((child = vect_build_slp_tree (vinfo, oprnd_info->def_stmts,
-					    group_size, &this_max_nunits,
+					    &this_max_nunits,
 					    tem, limit,
 					    &this_tree_size, bst_map)) != NULL)
 	    {
@@ -3807,7 +3810,7 @@ optimize_load_redistribution_1 (scalar_stmts_to_slp_tree_map_t *bst_map,
       bool *matches = XALLOCAVEC (bool, group_size);
       poly_uint64 max_nunits = 1;
       unsigned tree_size = 0, limit = 1;
-      node = vect_build_slp_tree (vinfo, stmts, group_size, &max_nunits,
+      node = vect_build_slp_tree (vinfo, stmts, &max_nunits,
 				  matches, &limit, &tree_size, bst_map);
       if (!node)
 	stmts.release ();
@@ -4236,7 +4239,7 @@ vect_build_slp_instance (vec_info *vinfo,
       matches[1] = false;
     }
   else
-    node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
+    node = vect_build_slp_tree (vinfo, scalar_stmts,
 				&max_nunits, matches, limit,
 				&tree_size, bst_map);
   if (node != NULL)
@@ -4498,7 +4501,7 @@ vect_analyze_slp_reduc_chain (loop_vec_info vinfo,
       bool *matches = XALLOCAVEC (bool, group_size);
       poly_uint64 max_nunits = 1;
       unsigned tree_size = 0;
-      slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
+      slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts,
 					   &max_nunits, matches, limit,
 					   &tree_size, bst_map);
       if (!node)
@@ -4646,7 +4649,7 @@ vect_analyze_slp_reduc_chain (loop_vec_info vinfo,
   for (unsigned i = 0; i < scalar_stmts.length (); ++i)
     REDUC_GROUP_FIRST_ELEMENT (scalar_stmts[i]) = scalar_stmts[0];
 
-  slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
+  slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts,
 				       &max_nunits, matches, limit,
 				       &tree_size, bst_map);
 
@@ -4790,7 +4793,7 @@ vect_analyze_slp_reduction (loop_vec_info vinfo,
   poly_uint64 max_nunits = 1;
   unsigned tree_size = 0;
 
-  slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
+  slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts,
 				       &max_nunits, matches, limit,
 				       &tree_size, bst_map);
   if (node != NULL)
@@ -4862,7 +4865,6 @@ vect_analyze_slp_reduction_group (loop_vec_info loop_vinfo,
   poly_uint64 max_nunits = 1;
   unsigned tree_size = 0;
   slp_tree node = vect_build_slp_tree (loop_vinfo, scalar_stmts,
-				       group_size,
 				       &max_nunits, matches, limit,
 				       &tree_size, bst_map);
   if (!node)
@@ -5089,7 +5091,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
       matches[1] = false;
     }
   else
-    node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
+    node = vect_build_slp_tree (vinfo, scalar_stmts,
 				&max_nunits, matches, limit,
 				&tree_size, bst_map);
   if (node != NULL)
@@ -5278,7 +5280,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
 	      for (unsigned j = start; j < end; ++j)
 		substmts.quick_push (scalar_stmts[j]);
 	      max_nunits = 1;
-	      node = vect_build_slp_tree (vinfo, substmts, end - start,
+	      node = vect_build_slp_tree (vinfo, substmts,
 					  &max_nunits,
 					  matches, limit, &tree_size, bst_map);
 	      if (node)
@@ -5651,7 +5653,6 @@ vect_lower_load_permutations (loop_vec_info loop_vinfo,
       unsigned limit = 1;
       unsigned tree_size = 0;
       slp_tree l0 = vect_build_slp_tree (loop_vinfo, stmts,
-					 group_lanes,
 					 &max_nunits, matches, &limit,
 					 &tree_size, bst_map);
       gcc_assert (!SLP_TREE_LOAD_PERMUTATION (l0).exists ());
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.