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.

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;
     }
 

Reply via email to