[PATCH v14 05/19] vect: New parameter for vect_maybe_update_slp_op_vectype

Christopher Bazley <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
Update all callers to pass a pointer to the vectorizer state
into this helper function. Its value is temporarily unused
but will be required for BB SLP with predicated tails.

gcc/ChangeLog:

	* tree-vect-loop.cc (vectorizable_lane_reducing): Pass
	loop_vinfo to vect_maybe_update_slp_op_vectype.
	(vectorizable_reduction): As above.
	(vectorizable_lc_phi): As above.
	(vectorizable_phi): Pass vinfo to
	vect_maybe_update_slp_op_vectype.
	(vectorizable_recurr): Pass loop_vinfo to
	vect_maybe_update_slp_op_vectype.
	(vectorizable_induction): As above.
	* tree-vect-slp.cc (vectorizable_slp_permutation_1): Pass vinfo
	to vect_maybe_update_slp_op_vectype.
	* tree-vect-stmts.cc (vectorizable_bswap): As above.
	(vectorizable_call): As above.
	(vectorizable_simd_clone_call): As above.
	(vectorizable_conversion): As above.
	(vectorizable_assignment): As above.
	(vectorizable_shift): As above.
	(vectorizable_operation): As above.
	(vectorizable_store): As above.
	(vectorizable_load): As above.
	(vectorizable_condition): As above.
	(vectorizable_comparison_1): As above.
	(vect_maybe_update_slp_op_vectype): Update definition to accept
	a parameter of type vec_info *. This is preparatory: the
	argument is currently unused.
	* tree-vectorizer.h (vect_maybe_update_slp_op_vectype): Update
	declaration to accept a parameter of type vec_info *.
---
 gcc/tree-vect-loop.cc  | 20 ++++++++-------
 gcc/tree-vect-slp.cc   |  2 +-
 gcc/tree-vect-stmts.cc | 57 ++++++++++++++++++++++--------------------
 gcc/tree-vectorizer.h  |  2 +-
 4 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d15675b2f35..1e0a03b550a 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -6833,7 +6833,7 @@ vectorizable_lane_reducing (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
 	    return false;
 	}
 
-      if (!vect_maybe_update_slp_op_vectype (slp_op, vectype))
+      if (!vect_maybe_update_slp_op_vectype (loop_vinfo, slp_op, vectype))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6970,7 +6970,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
       unsigned j;
       slp_tree child;
       FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
-	if (!vect_maybe_update_slp_op_vectype (child,
+	if (!vect_maybe_update_slp_op_vectype (loop_vinfo, child,
 					       SLP_TREE_VECTYPE (slp_node)))
 	  {
 	    if (dump_enabled_p ())
@@ -7103,7 +7103,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
 		  vectype_op = get_vectype_for_scalar_type (loop_vinfo,
 							    type_op);
 		  if (!vectype_op
-		      || !vect_maybe_update_slp_op_vectype (op_node,
+		      || !vect_maybe_update_slp_op_vectype (loop_vinfo, op_node,
 							    vectype_op))
 		    return false;
 		}
@@ -7814,7 +7814,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
 
   if (single_defuse_cycle || reduction_type == FOLD_LEFT_REDUCTION)
     for (i = 0; i < (int) op.num_ops; i++)
-      if (!vect_maybe_update_slp_op_vectype (slp_op[i], vectype_op[i]))
+      if (!vect_maybe_update_slp_op_vectype (loop_vinfo, slp_op[i],
+					     vectype_op[i]))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -8508,7 +8509,8 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo,
 
   /* Deal with copies from externs or constants that disguise as
      loop-closed PHI nodes (PR97886).  */
-  if (!vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+  if (!vect_maybe_update_slp_op_vectype (loop_vinfo,
+					 SLP_TREE_CHILDREN (slp_node)[0],
 					 SLP_TREE_VECTYPE (slp_node)))
     {
       if (dump_enabled_p ())
@@ -8584,7 +8586,7 @@ vectorizable_phi (bb_vec_info vinfo,
 			       "PHI node with unvectorized backedge def\n");
 	    return false;
 	  }
-	else if (!vect_maybe_update_slp_op_vectype (child, vectype))
+	else if (!vect_maybe_update_slp_op_vectype (vinfo, child, vectype))
 	  {
 	    if (dump_enabled_p ())
 	      dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -8773,7 +8775,7 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
       unsigned j;
       slp_tree child;
       FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
-	if (!vect_maybe_update_slp_op_vectype (child, vectype))
+	if (!vect_maybe_update_slp_op_vectype (loop_vinfo, child, vectype))
 	  {
 	    if (dump_enabled_p ())
 	      dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -9688,8 +9690,8 @@ vectorizable_induction (loop_vec_info loop_vinfo,
       unsigned j;
       slp_tree child;
       FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
-	if (!vect_maybe_update_slp_op_vectype
-	    (child, SLP_TREE_VECTYPE (slp_node)))
+	if (!vect_maybe_update_slp_op_vectype (loop_vinfo, child,
+					       SLP_TREE_VECTYPE (slp_node)))
 	  {
 	    if (dump_enabled_p ())
 	      dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 71b7288c94f..b9b2224dbe4 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -11514,7 +11514,7 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, gimple_stmt_iterator *gsi,
   FOR_EACH_VEC_ELT (children, i, child)
     {
       if ((SLP_TREE_DEF_TYPE (child) != vect_internal_def
-	   && !vect_maybe_update_slp_op_vectype (child, op_vectype))
+	   && !vect_maybe_update_slp_op_vectype (vinfo, child, op_vectype))
 	  || !types_compatible_p (SLP_TREE_VECTYPE (child), op_vectype)
 	  || !types_compatible_p (TREE_TYPE (vectype), TREE_TYPE (op_vectype)))
 	{
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 293a3fd97f5..978fb288089 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3372,7 +3372,7 @@ vectorizable_bswap (vec_info *vinfo,
 
   if (cost_vec)
     {
-      if (!vect_maybe_update_slp_op_vectype (slp_op[0], vectype_in))
+      if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op[0], vectype_in))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -3734,7 +3734,7 @@ vectorizable_call (vec_info *vinfo,
   if (cost_vec) /* transformation not required.  */
     {
       for (i = 0; i < nargs; ++i)
-	if (!vect_maybe_update_slp_op_vectype (slp_op[i],
+	if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op[i],
 					       vectypes[i]
 					       ? vectypes[i] : vectype_in))
 	  {
@@ -4452,7 +4452,8 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
   if (cost_vec) /* transformation not required.  */
     {
       for (unsigned i = 0; i < nargs; ++i)
-	if (!vect_maybe_update_slp_op_vectype (slp_op[i], arginfo[i].vectype))
+	if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op[i],
+					       arginfo[i].vectype))
 	  {
 	    if (dump_enabled_p ())
 	      dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5722,8 +5723,8 @@ vectorizable_conversion (vec_info *vinfo,
 
   if (cost_vec)		/* transformation not required.  */
     {
-      if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype_in)
-	  || !vect_maybe_update_slp_op_vectype (slp_op1, vectype_in))
+      if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op0, vectype_in)
+	  || !vect_maybe_update_slp_op_vectype (vinfo, slp_op1, vectype_in))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6089,7 +6090,7 @@ vectorizable_assignment (vec_info *vinfo,
 
   if (cost_vec) /* transformation not required.  */
     {
-      if (!vect_maybe_update_slp_op_vectype (slp_op, vectype_in))
+      if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op, vectype_in))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6418,13 +6419,13 @@ vectorizable_shift (vec_info *vinfo,
 
   if (cost_vec) /* transformation not required.  */
     {
-      if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype)
+      if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op0, vectype)
 	  || ((!scalar_shift_arg || dt[1] == vect_internal_def)
-	      && (!incompatible_op1_vectype_p
-		  || dt[1] == vect_constant_def)
-	      && !vect_maybe_update_slp_op_vectype
-			 (slp_op1,
-			  incompatible_op1_vectype_p ? vectype : op1_vectype)))
+	      && (!incompatible_op1_vectype_p || dt[1] == vect_constant_def)
+	      && !vect_maybe_update_slp_op_vectype (vinfo, slp_op1,
+						    incompatible_op1_vectype_p
+						      ? vectype
+						      : op1_vectype)))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6853,9 +6854,9 @@ vectorizable_operation (vec_info *vinfo,
 	}
 
       /* Put types on constant and invariant SLP children.  */
-      if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype)
-	  || !vect_maybe_update_slp_op_vectype (slp_op1, vectype)
-	  || !vect_maybe_update_slp_op_vectype (slp_op2, vectype))
+      if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op0, vectype)
+	  || !vect_maybe_update_slp_op_vectype (vinfo, slp_op1, vectype)
+	  || !vect_maybe_update_slp_op_vectype (vinfo, slp_op2, vectype))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -8320,9 +8321,9 @@ vectorizable_store (vec_info *vinfo,
 						    group_size, &ls, mask_node))
 	LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false;
 
-      if (!vect_maybe_update_slp_op_vectype (op_node, vectype)
+      if (!vect_maybe_update_slp_op_vectype (vinfo, op_node, vectype)
 	  || (mask_node
-	      && !vect_maybe_update_slp_op_vectype (mask_node,
+	      && !vect_maybe_update_slp_op_vectype (vinfo, mask_node,
 						    mask_vectype)))
 	{
 	  if (dump_enabled_p ())
@@ -8780,7 +8781,7 @@ vectorizable_store (vec_info *vinfo,
 	   above only handles the mask and the first store operand node.  */
 	for (slp_tree child : SLP_TREE_CHILDREN (slp_node))
 	  if (child != mask_node
-	      && !vect_maybe_update_slp_op_vectype (child, vectype))
+	      && !vect_maybe_update_slp_op_vectype (vinfo, child, vectype))
 	    {
 	      if (dump_enabled_p ())
 		dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -9983,7 +9984,7 @@ vectorizable_load (vec_info *vinfo,
 	}
 
       if (mask_node
-	  && !vect_maybe_update_slp_op_vectype (mask_node,
+	  && !vect_maybe_update_slp_op_vectype (vinfo, mask_node,
 						mask_vectype))
 	{
 	  if (dump_enabled_p ())
@@ -12339,13 +12340,14 @@ vectorizable_condition (vec_info *vinfo,
 		       || !expand_vec_cond_expr_p (vectype, vec_cmp_type))))
 	return false;
 
-      if (!vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+      if (!vect_maybe_update_slp_op_vectype (vinfo,
+					     SLP_TREE_CHILDREN (slp_node)[0],
 					     comp_vectype)
 	  || (op_adjust == 1
-	      && !vect_maybe_update_slp_op_vectype
-			      (SLP_TREE_CHILDREN (slp_node)[1], comp_vectype))
-	  || !vect_maybe_update_slp_op_vectype (then_slp_node, vectype)
-	  || !vect_maybe_update_slp_op_vectype (else_slp_node, vectype))
+	      && !vect_maybe_update_slp_op_vectype (
+		vinfo, SLP_TREE_CHILDREN (slp_node)[1], comp_vectype))
+	  || !vect_maybe_update_slp_op_vectype (vinfo, then_slp_node, vectype)
+	  || !vect_maybe_update_slp_op_vectype (vinfo, else_slp_node, vectype))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -12784,8 +12786,8 @@ vectorizable_comparison_1 (vec_info *vinfo, tree vectype,
 	}
 
       /* Put types on constant and invariant SLP children.  */
-      if (!vect_maybe_update_slp_op_vectype (slp_rhs1, vectype)
-	  || !vect_maybe_update_slp_op_vectype (slp_rhs2, vectype))
+      if (!vect_maybe_update_slp_op_vectype (vinfo, slp_rhs1, vectype)
+	  || !vect_maybe_update_slp_op_vectype (vinfo, slp_rhs2, vectype))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -14024,7 +14026,7 @@ vect_is_simple_use (vec_info *vinfo, slp_tree slp_node,
    for example when conflicting vector types are present.  */
 
 bool
-vect_maybe_update_slp_op_vectype (slp_tree op, tree vectype)
+vect_maybe_update_slp_op_vectype (vec_info *vinfo, slp_tree op, tree vectype)
 {
   if (!op || SLP_TREE_DEF_TYPE (op) == vect_internal_def)
     return true;
@@ -14038,6 +14040,7 @@ vect_maybe_update_slp_op_vectype (slp_tree op, tree vectype)
       && SLP_TREE_DEF_TYPE (op) == vect_external_def
       && SLP_TREE_LANES (op) > 1)
     return false;
+  (void) vinfo; /* FORNOW */
   SLP_TREE_VECTYPE (op) = vectype;
   return true;
 }
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 29ce87e1fb0..7017acdd43a 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2541,7 +2541,7 @@ extern bool vect_is_simple_use (vec_info *, slp_tree,
 				unsigned, tree *, slp_tree *,
 				enum vect_def_type *,
 				tree *, stmt_vec_info * = NULL);
-extern bool vect_maybe_update_slp_op_vectype (slp_tree, tree);
+extern bool vect_maybe_update_slp_op_vectype (vec_info *, slp_tree, tree);
 extern tree perm_mask_for_reverse (tree);
 extern bool supportable_widening_operation (code_helper, tree, tree, bool,
 					    code_helper*, code_helper*,
-- 
2.43.0
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.