diff mbox series

Cleanup parameter of vectorizable_live_operation

Message ID VI1PR03MB45284DABDEF220369B191958E4970@VI1PR03MB4528.eurprd03.prod.outlook.com
State New
Headers show
Series Cleanup parameter of vectorizable_live_operation | expand

Commit Message

Bernd Edlinger Oct. 11, 2019, 12:36 p.m. UTC
Hi Richard,

I became aware of this while looking at the -Wshadow=compatible-local warnings.
The function vectorizable_live_operation uses a parameter called "vec_stmt"
that is shadowed by something also called "vec_stmt".  But in this case,
the vec_stmt actually only used as a boolean, i.e. pointer is NULL or not.

This changes the parameter vec_stmt to vec_stmt_p, and propagates that
change to can_vectorize_live_stmts.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

Comments

Richard Biener Oct. 11, 2019, 1:01 p.m. UTC | #1
On Fri, 11 Oct 2019, Bernd Edlinger wrote:

> Hi Richard,
> 
> I became aware of this while looking at the -Wshadow=compatible-local warnings.
> The function vectorizable_live_operation uses a parameter called "vec_stmt"
> that is shadowed by something also called "vec_stmt".  But in this case,
> the vec_stmt actually only used as a boolean, i.e. pointer is NULL or not.
> 
> This changes the parameter vec_stmt to vec_stmt_p, and propagates that
> change to can_vectorize_live_stmts.
> 
> 
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?

OK.  Some more refactoring is in order here but it's an improvement.

Thanks,
Richard.
diff mbox series

Patch

2019-10-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* tree-vect-loop.c (vect_analyze_loop_operations): Adjust call to
	vectorizable_live_operation.
	(vectorizable_live_operation): Adjust parameters.
	* tree-vect-stmts.c (vect_init_vector,
	vect_gen_widened_results_half): Fix typo in function comment.
	(can_vectorize_live_stmts): Adjust function comment.
	Adjust parameters.  Adjust call to vectorizable_live_operation.
	(vect_analyze_stmt): Adjust call to can_vectorize_live_stmts.
	(vect_transform_stmt): Adjust function comment.  Adjust call to
	can_vectorize_live_stmts.
	* tree-vectorizer.h (vectorizable_live_operation): Adjust parameters.

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	(revision 276843)
+++ gcc/tree-vect-loop.c	(working copy)
@@ -1566,7 +1566,7 @@  vect_analyze_loop_operations (loop_vec_info loop_v
 	      && STMT_VINFO_LIVE_P (stmt_info)
 	      && !PURE_SLP_STMT (stmt_info))
 	    ok = vectorizable_live_operation (stmt_info, NULL, NULL, NULL,
-					      -1, NULL, &cost_vec);
+					      -1, false, &cost_vec);
 
           if (!ok)
 	    return opt_result::failure_at (phi,
@@ -7628,9 +7628,9 @@  vectorizable_induction (stmt_vec_info stmt_info,
 
 bool
 vectorizable_live_operation (stmt_vec_info stmt_info,
-			     gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
+			     gimple_stmt_iterator *gsi,
 			     slp_tree slp_node, slp_instance slp_node_instance,
-			     int slp_index, stmt_vec_info *vec_stmt,
+			     int slp_index, bool vec_stmt_p,
 			     stmt_vector_for_cost *)
 {
   loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
@@ -7652,7 +7652,7 @@  vectorizable_live_operation (stmt_vec_info stmt_in
      validity so just trigger the transform here.  */
   if (STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info)))
     {
-      if (!vec_stmt)
+      if (!vec_stmt_p)
 	return true;
       if (slp_node)
 	{
@@ -7721,7 +7721,7 @@  vectorizable_live_operation (stmt_vec_info stmt_in
 	}
     }
 
-  if (!vec_stmt)
+  if (!vec_stmt_p)
     {
       /* No transformation required.  */
       if (LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo))
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c	(revision 276843)
+++ gcc/tree-vect-stmts.c	(working copy)
@@ -1449,7 +1449,7 @@  vect_init_vector_1 (stmt_vec_info stmt_vinfo, gimp
    Insert a new stmt (INIT_STMT) that initializes a new variable of type
    TYPE with the value VAL.  If TYPE is a vector type and VAL does not have
    vector type a vector with all elements equal to VAL is created first.
-   Place the initialization at BSI if it is not NULL.  Otherwise, place the
+   Place the initialization at GSI if it is not NULL.  Otherwise, place the
    initialization at the loop preheader.
    Return the DEF of INIT_STMT.
    It will be used in the vectorization of STMT_INFO.  */
@@ -4484,7 +4484,7 @@  vectorizable_simd_clone_call (stmt_vec_info stmt_i
 
    Create a vector stmt whose code, type, number of arguments, and result
    variable are CODE, OP_TYPE, and VEC_DEST, and its arguments are
-   VEC_OPRND0 and VEC_OPRND1.  The new vector stmt is to be inserted at BSI.
+   VEC_OPRND0 and VEC_OPRND1.  The new vector stmt is to be inserted at GSI.
    In the case that CODE is a CALL_EXPR, this means that a call to DECL
    needs to be created (DECL is a function-decl of a target-builtin).
    STMT_INFO is the original scalar stmt that we are vectorizing.  */
@@ -10474,12 +10474,12 @@  vectorizable_comparison (stmt_vec_info stmt_info,
 /* If SLP_NODE is nonnull, return true if vectorizable_live_operation
    can handle all live statements in the node.  Otherwise return true
    if STMT_INFO is not live or if vectorizable_live_operation can handle it.
-   GSI and VEC_STMT are as for vectorizable_live_operation.  */
+   GSI and VEC_STMT_P are as for vectorizable_live_operation.  */
 
 static bool
 can_vectorize_live_stmts (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
 			  slp_tree slp_node, slp_instance slp_node_instance,
-			  stmt_vec_info *vec_stmt,
+			  bool vec_stmt_p,
 			  stmt_vector_for_cost *cost_vec)
 {
   if (slp_node)
@@ -10491,7 +10491,7 @@  can_vectorize_live_stmts (stmt_vec_info stmt_info,
 	  if (STMT_VINFO_LIVE_P (slp_stmt_info)
 	      && !vectorizable_live_operation (slp_stmt_info, gsi, slp_node,
 					       slp_node_instance, i,
-					       vec_stmt, cost_vec))
+					       vec_stmt_p, cost_vec))
 	    return false;
 	}
     }
@@ -10498,7 +10498,7 @@  can_vectorize_live_stmts (stmt_vec_info stmt_info,
   else if (STMT_VINFO_LIVE_P (stmt_info)
 	   && !vectorizable_live_operation (stmt_info, gsi, slp_node,
 					    slp_node_instance, -1,
-					    vec_stmt, cost_vec))
+					    vec_stmt_p, cost_vec))
     return false;
 
   return true;
@@ -10712,7 +10712,7 @@  vect_analyze_stmt (stmt_vec_info stmt_info, bool *
       && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type
       && STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type
       && !can_vectorize_live_stmts (stmt_info, NULL, node, node_instance,
-				    NULL, cost_vec))
+				    false, cost_vec))
     return opt_result::failure_at (stmt_info->stmt,
 				   "not vectorized:"
 				   " live stmt not supported: %G",
@@ -10724,7 +10724,7 @@  vect_analyze_stmt (stmt_vec_info stmt_info, bool *
 
 /* Function vect_transform_stmt.
 
-   Create a vectorized stmt to replace STMT_INFO, and insert it at BSI.  */
+   Create a vectorized stmt to replace STMT_INFO, and insert it at GSI.  */
 
 bool
 vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
@@ -10945,7 +10945,7 @@  vect_transform_stmt (stmt_vec_info stmt_info, gimp
   /* Handle stmts whose DEF is used outside the loop-nest that is
      being vectorized.  */
   done = can_vectorize_live_stmts (stmt_info, gsi, slp_node,
-				   slp_node_instance, &vec_stmt, NULL);
+				   slp_node_instance, true, NULL);
   gcc_assert (done);
 
   return false;
Index: gcc/tree-vectorizer.h
===================================================================
--- gcc/tree-vectorizer.h	(revision 276843)
+++ gcc/tree-vectorizer.h	(working copy)
@@ -1653,8 +1653,7 @@  extern opt_loop_vec_info vect_analyze_loop_form (c
 						 vec_info_shared *);
 extern bool vectorizable_live_operation (stmt_vec_info, gimple_stmt_iterator *,
 					 slp_tree, slp_instance, int,
-					 stmt_vec_info *,
-					 stmt_vector_for_cost *);
+					 bool, stmt_vector_for_cost *);
 extern bool vectorizable_reduction (stmt_vec_info, slp_tree, slp_instance,
 				    stmt_vector_for_cost *);
 extern bool vectorizable_induction (stmt_vec_info, gimple_stmt_iterator *,