diff mbox series

[3/8] vect: Use one reduction_type local variable

Message ID LV2PR01MB783924F26D1B24769637E9D1F7CC2@LV2PR01MB7839.prod.exchangelabs.com
State New
Headers show
Series [PATH,1/8] vect: Add a function to check lane-reducing stmt | expand

Commit Message

Feng Xue OS June 16, 2024, 7:23 a.m. UTC
Two local variables were defined to refer same STMT_VINFO_REDUC_TYPE, better
to keep only one.

Thanks,
Feng

---
gcc/
	* tree-vect-loop.cc (vectorizable_reduction): Remove v_reduc_type, and
	replace it to another local variable reduction_type.
---
 gcc/tree-vect-loop.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Richard Biener June 19, 2024, 12:35 p.m. UTC | #1
On Sun, Jun 16, 2024 at 9:23 AM Feng Xue OS <fxue@os.amperecomputing.com> wrote:
>
> Two local variables were defined to refer same STMT_VINFO_REDUC_TYPE, better
> to keep only one.

OK.

Richard.

> Thanks,
> Feng
>
> ---
> gcc/
>         * tree-vect-loop.cc (vectorizable_reduction): Remove v_reduc_type, and
>         replace it to another local variable reduction_type.
> ---
>  gcc/tree-vect-loop.cc | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index 6e8b3639daf..0f7b125e72d 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -7868,10 +7868,10 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
>    if (lane_reducing)
>      STMT_VINFO_REDUC_VECTYPE_IN (stmt_info) = vectype_in;
>
> -  enum vect_reduction_type v_reduc_type = STMT_VINFO_REDUC_TYPE (phi_info);
> -  STMT_VINFO_REDUC_TYPE (reduc_info) = v_reduc_type;
> +  enum vect_reduction_type reduction_type = STMT_VINFO_REDUC_TYPE (phi_info);
> +  STMT_VINFO_REDUC_TYPE (reduc_info) = reduction_type;
>    /* If we have a condition reduction, see if we can simplify it further.  */
> -  if (v_reduc_type == COND_REDUCTION)
> +  if (reduction_type == COND_REDUCTION)
>      {
>        if (slp_node && SLP_TREE_LANES (slp_node) != 1)
>         return false;
> @@ -8038,7 +8038,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
>
>    STMT_VINFO_REDUC_CODE (reduc_info) = orig_code;
>
> -  vect_reduction_type reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
> +  reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
>    if (reduction_type == TREE_CODE_REDUCTION)
>      {
>        /* Check whether it's ok to change the order of the computation.
> --
> 2.17.1
diff mbox series

Patch

From 19dc1c91f10ec22e695b9003cae1f4ab5aa45250 Mon Sep 17 00:00:00 2001
From: Feng Xue <fxue@os.amperecomputing.com>
Date: Sun, 16 Jun 2024 12:17:26 +0800
Subject: [PATCH 3/8] vect: Use one reduction_type local variable

Two local variables were defined to refer same STMT_VINFO_REDUC_TYPE, better
to keep only one.

2024-06-16 Feng Xue <fxue@os.amperecomputing.com>

gcc/
	* tree-vect-loop.cc (vectorizable_reduction): Remove v_reduc_type, and
	replace it to another local variable reduction_type.
---
 gcc/tree-vect-loop.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 6e8b3639daf..0f7b125e72d 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7868,10 +7868,10 @@  vectorizable_reduction (loop_vec_info loop_vinfo,
   if (lane_reducing)
     STMT_VINFO_REDUC_VECTYPE_IN (stmt_info) = vectype_in;
 
-  enum vect_reduction_type v_reduc_type = STMT_VINFO_REDUC_TYPE (phi_info);
-  STMT_VINFO_REDUC_TYPE (reduc_info) = v_reduc_type;
+  enum vect_reduction_type reduction_type = STMT_VINFO_REDUC_TYPE (phi_info);
+  STMT_VINFO_REDUC_TYPE (reduc_info) = reduction_type;
   /* If we have a condition reduction, see if we can simplify it further.  */
-  if (v_reduc_type == COND_REDUCTION)
+  if (reduction_type == COND_REDUCTION)
     {
       if (slp_node && SLP_TREE_LANES (slp_node) != 1)
 	return false;
@@ -8038,7 +8038,7 @@  vectorizable_reduction (loop_vec_info loop_vinfo,
 
   STMT_VINFO_REDUC_CODE (reduc_info) = orig_code;
 
-  vect_reduction_type reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
+  reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
   if (reduction_type == TREE_CODE_REDUCTION)
     {
       /* Check whether it's ok to change the order of the computation.
-- 
2.17.1