tree-optimization/92260 - improve fix
authorRichard Biener <rguenther@suse.de>
Fri, 15 May 2020 09:14:53 +0000 (11:14 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 15 May 2020 11:54:32 +0000 (13:54 +0200)
This improves the fix for PR92260 changing the number of vector
computation to the canonical one, not needing to look at the
using stmt.

2020-05-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92260
* tree-vect-slp.c (vect_get_constant_vectors): Compute
the number of vector stmts in a canonical way.

gcc/ChangeLog
gcc/tree-vect-slp.c

index cc761f2c6b61273ee3c18a2248dbe3cbf1ccc160..5eaa1b8af2788c6737b5cfc7dd8843abdd0732da 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92260
+       * tree-vect-slp.c (vect_get_constant_vectors): Compute
+       the number of vector stmts in a canonical way.
+
 2020-05-15  Martin Liska  <mliska@suse.cz>
 
        * hsa-gen.c (get_symbol_for_decl): Fix misleading indentation
index 6f623955ce5191edfe81efed519f9f8cf26b4fcb..15eea74d8d1af29bacb9eeb2a682110b4f79f313 100644 (file)
@@ -3561,19 +3561,12 @@ vect_get_constant_vectors (vec_info *vinfo,
   else
     vector_type = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op), op_node);
 
-  /* ???  For lane-reducing ops we should also have the required number
-     of vector stmts initialized rather than second-guessing here.  */
-  unsigned int number_of_vectors;
-  if (is_gimple_assign (stmt_vinfo->stmt)
-      && (gimple_assign_rhs_code (stmt_vinfo->stmt) == SAD_EXPR
-         || gimple_assign_rhs_code (stmt_vinfo->stmt) == DOT_PROD_EXPR
-         || gimple_assign_rhs_code (stmt_vinfo->stmt) == WIDEN_SUM_EXPR))
-    number_of_vectors = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
-  else
-    number_of_vectors
-      = vect_get_num_vectors (SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node)
-                             * TYPE_VECTOR_SUBPARTS (stmt_vectype),
-                             vector_type);
+  poly_uint64 vf = 1;
+  if (loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo))
+    vf = loop_vinfo->vectorization_factor;
+  unsigned int number_of_vectors
+    = vect_get_num_vectors (vf * group_size, vector_type);
+
   vec_oprnds->create (number_of_vectors);
   auto_vec<tree> voprnds (number_of_vectors);