Re: [PATCH] Cleanup parameter of vectorizable_live_operation

2019-10-11 Thread Richard Biener
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.


[PATCH] Cleanup parameter of vectorizable_live_operation

2019-10-11 Thread Bernd Edlinger
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.
2019-10-11  Bernd Edlinger  

	* 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))