diff mbox

Move STMT_VINFO_TYPE assignment in vectorizable_reduction

Message ID g4ei4mzbw4.fsf@linaro.org
State Accepted
Headers show

Commit Message

Richard Sandiford April 28, 2011, 2:30 p.m. UTC
When I started looking at PR 48765, I noticed that vectorizable_reduction
set STMT_VINFO_TYPE before checking the reduction cost.  This probably
doesn't matter in practice, and certainly has nothing to do with fixing
the PR (which Ira has done, thanks), but it seems like it might
cause confusion.

Tested on x86_64-linux-gnu.  OK to install?

Richard


gcc/
	* tree-vect-loop.c (vectorizable_reduction): Check reduction cost
	before setting STMT_VINFO_TYPE.

Comments

Ira Rosen April 28, 2011, 5:27 p.m. UTC | #1
gcc-patches-owner@gcc.gnu.org wrote on 28/04/2011 05:30:35 PM:

>
> When I started looking at PR 48765, I noticed that vectorizable_reduction
> set STMT_VINFO_TYPE before checking the reduction cost.  This probably
> doesn't matter in practice, and certainly has nothing to do with fixing
> the PR (which Ira has done, thanks), but it seems like it might
> cause confusion.
>
> Tested on x86_64-linux-gnu.  OK to install?

OK.

Thanks,
Ira

>
> Richard
>
>
> gcc/
>    * tree-vect-loop.c (vectorizable_reduction): Check reduction cost
>    before setting STMT_VINFO_TYPE.
>
> Index: gcc/tree-vect-loop.c
> ===================================================================
> --- gcc/tree-vect-loop.c   2011-03-30 15:49:32.000000000 +0100
> +++ gcc/tree-vect-loop.c   2011-04-27 09:11:40.000000000 +0100
> @@ -4305,9 +4305,9 @@ vectorizable_reduction (gimple stmt, gim
>
>    if (!vec_stmt) /* transformation not required.  */
>      {
> -      STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
>        if (!vect_model_reduction_cost (stmt_info,
epilog_reduc_code,ncopies))
>          return false;
> +      STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
>        return true;
>      }
>
diff mbox

Patch

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	2011-03-30 15:49:32.000000000 +0100
+++ gcc/tree-vect-loop.c	2011-04-27 09:11:40.000000000 +0100
@@ -4305,9 +4305,9 @@  vectorizable_reduction (gimple stmt, gim
 
   if (!vec_stmt) /* transformation not required.  */
     {
-      STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
       if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))
         return false;
+      STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
       return true;
     }