public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]middle-end: rename main_exit_p in reduction code.
@ 2024-01-23 16:03 Tamar Christina
  2024-01-23 17:13 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2024-01-23 16:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther, jlaw

[-- Attachment #1: Type: text/plain, Size: 2727 bytes --]

Hi All,

This renamed main_exit_p to last_val_reduc_p to more accurately
reflect what the value is calculating.

Ok for master if bootstrap passes? Incremental build shows it's fine.

Thanks,
Tamar

gcc/ChangeLog:

	* tree-vect-loop.cc (vect_get_vect_def,
	vect_create_epilog_for_reduction): Rename main_exit_p to
	last_val_reduc_p.

--- inline copy of patch -- 
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 4da1421c8f09746ef4b293573e4f861b642349e1..21a997599f397ba6c2cd15c3b9c8b04513bc0c83 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -5892,25 +5892,26 @@ vect_create_partial_epilog (tree vec_def, tree vectype, code_helper code,
 }
 
 /* Retrieves the definining statement to be used for a reduction.
-   For MAIN_EXIT_P we use the current VEC_STMTs and otherwise we look at
-   the reduction definitions.  */
+   For LAST_VAL_REDUC_P we use the current VEC_STMTs which correspond to the
+   final value after vectorization and otherwise we look at the reduction
+   definitions to get the first.  */
 
 tree
 vect_get_vect_def (stmt_vec_info reduc_info, slp_tree slp_node,
-		   slp_instance slp_node_instance, bool main_exit_p, unsigned i,
-		   vec <gimple *> &vec_stmts)
+		   slp_instance slp_node_instance, bool last_val_reduc_p,
+		   unsigned i, vec <gimple *> &vec_stmts)
 {
   tree def;
 
   if (slp_node)
     {
-      if (!main_exit_p)
+      if (!last_val_reduc_p)
         slp_node = slp_node_instance->reduc_phis;
       def = vect_get_slp_vect_def (slp_node, i);
     }
   else
     {
-      if (!main_exit_p)
+      if (!last_val_reduc_p)
 	reduc_info = STMT_VINFO_REDUC_DEF (vect_orig_stmt (reduc_info));
       vec_stmts = STMT_VINFO_VEC_STMTS (reduc_info);
       def = gimple_get_lhs (vec_stmts[0]);
@@ -5982,8 +5983,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
      loop-closed PHI of the inner loop which we remember as
      def for the reduction PHI generation.  */
   bool double_reduc = false;
-  bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit
-		     && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
+  bool last_val_reduc_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit
+			  && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
   stmt_vec_info rdef_info = stmt_info;
   if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def)
     {
@@ -6233,7 +6234,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
     {
       gimple_seq stmts = NULL;
       def = vect_get_vect_def (rdef_info, slp_node, slp_node_instance,
-			       main_exit_p, i, vec_stmts);
+			       last_val_reduc_p, i, vec_stmts);
       for (j = 0; j < ncopies; j++)
 	{
 	  tree new_def = copy_ssa_name (def);




-- 

[-- Attachment #2: rb18200.patch --]
[-- Type: text/plain, Size: 2359 bytes --]

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 4da1421c8f09746ef4b293573e4f861b642349e1..21a997599f397ba6c2cd15c3b9c8b04513bc0c83 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -5892,25 +5892,26 @@ vect_create_partial_epilog (tree vec_def, tree vectype, code_helper code,
 }
 
 /* Retrieves the definining statement to be used for a reduction.
-   For MAIN_EXIT_P we use the current VEC_STMTs and otherwise we look at
-   the reduction definitions.  */
+   For LAST_VAL_REDUC_P we use the current VEC_STMTs which correspond to the
+   final value after vectorization and otherwise we look at the reduction
+   definitions to get the first.  */
 
 tree
 vect_get_vect_def (stmt_vec_info reduc_info, slp_tree slp_node,
-		   slp_instance slp_node_instance, bool main_exit_p, unsigned i,
-		   vec <gimple *> &vec_stmts)
+		   slp_instance slp_node_instance, bool last_val_reduc_p,
+		   unsigned i, vec <gimple *> &vec_stmts)
 {
   tree def;
 
   if (slp_node)
     {
-      if (!main_exit_p)
+      if (!last_val_reduc_p)
         slp_node = slp_node_instance->reduc_phis;
       def = vect_get_slp_vect_def (slp_node, i);
     }
   else
     {
-      if (!main_exit_p)
+      if (!last_val_reduc_p)
 	reduc_info = STMT_VINFO_REDUC_DEF (vect_orig_stmt (reduc_info));
       vec_stmts = STMT_VINFO_VEC_STMTS (reduc_info);
       def = gimple_get_lhs (vec_stmts[0]);
@@ -5982,8 +5983,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
      loop-closed PHI of the inner loop which we remember as
      def for the reduction PHI generation.  */
   bool double_reduc = false;
-  bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit
-		     && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
+  bool last_val_reduc_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit
+			  && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
   stmt_vec_info rdef_info = stmt_info;
   if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def)
     {
@@ -6233,7 +6234,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
     {
       gimple_seq stmts = NULL;
       def = vect_get_vect_def (rdef_info, slp_node, slp_node_instance,
-			       main_exit_p, i, vec_stmts);
+			       last_val_reduc_p, i, vec_stmts);
       for (j = 0; j < ncopies; j++)
 	{
 	  tree new_def = copy_ssa_name (def);




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH]middle-end: rename main_exit_p in reduction code.
  2024-01-23 16:03 [PATCH]middle-end: rename main_exit_p in reduction code Tamar Christina
@ 2024-01-23 17:13 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-01-23 17:13 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd, rguenther, jlaw



> Am 23.01.2024 um 17:04 schrieb Tamar Christina <tamar.christina@arm.com>:
> 
> Hi All,
> 
> This renamed main_exit_p to last_val_reduc_p to more accurately
> reflect what the value is calculating.
> 
> Ok for master if bootstrap passes? Incremental build shows it's fine.

Ok

> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
>    * tree-vect-loop.cc (vect_get_vect_def,
>    vect_create_epilog_for_reduction): Rename main_exit_p to
>    last_val_reduc_p.
> 
> --- inline copy of patch --
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index 4da1421c8f09746ef4b293573e4f861b642349e1..21a997599f397ba6c2cd15c3b9c8b04513bc0c83 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -5892,25 +5892,26 @@ vect_create_partial_epilog (tree vec_def, tree vectype, code_helper code,
> }
> 
> /* Retrieves the definining statement to be used for a reduction.
> -   For MAIN_EXIT_P we use the current VEC_STMTs and otherwise we look at
> -   the reduction definitions.  */
> +   For LAST_VAL_REDUC_P we use the current VEC_STMTs which correspond to the
> +   final value after vectorization and otherwise we look at the reduction
> +   definitions to get the first.  */
> 
> tree
> vect_get_vect_def (stmt_vec_info reduc_info, slp_tree slp_node,
> -           slp_instance slp_node_instance, bool main_exit_p, unsigned i,
> -           vec <gimple *> &vec_stmts)
> +           slp_instance slp_node_instance, bool last_val_reduc_p,
> +           unsigned i, vec <gimple *> &vec_stmts)
> {
>   tree def;
> 
>   if (slp_node)
>     {
> -      if (!main_exit_p)
> +      if (!last_val_reduc_p)
>         slp_node = slp_node_instance->reduc_phis;
>       def = vect_get_slp_vect_def (slp_node, i);
>     }
>   else
>     {
> -      if (!main_exit_p)
> +      if (!last_val_reduc_p)
>    reduc_info = STMT_VINFO_REDUC_DEF (vect_orig_stmt (reduc_info));
>       vec_stmts = STMT_VINFO_VEC_STMTS (reduc_info);
>       def = gimple_get_lhs (vec_stmts[0]);
> @@ -5982,8 +5983,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
>      loop-closed PHI of the inner loop which we remember as
>      def for the reduction PHI generation.  */
>   bool double_reduc = false;
> -  bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit
> -             && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
> +  bool last_val_reduc_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit
> +              && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
>   stmt_vec_info rdef_info = stmt_info;
>   if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def)
>     {
> @@ -6233,7 +6234,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
>     {
>       gimple_seq stmts = NULL;
>       def = vect_get_vect_def (rdef_info, slp_node, slp_node_instance,
> -                   main_exit_p, i, vec_stmts);
> +                   last_val_reduc_p, i, vec_stmts);
>       for (j = 0; j < ncopies; j++)
>    {
>      tree new_def = copy_ssa_name (def);
> 
> 
> 
> 
> --
> <rb18200.patch>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-23 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 16:03 [PATCH]middle-end: rename main_exit_p in reduction code Tamar Christina
2024-01-23 17:13 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).