On Mon, 20 Feb 2012, Jakub Jelinek wrote:

> On Mon, Feb 20, 2012 at 04:11:13PM +0100, Richard Guenther wrote:
> > This fixes PR52298, we need to use the proper DR step for outer
> > loop vectorization.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
> 
> Thanks.
> 
> > *************** vectorizable_load (gimple stmt, gimple_s
> > *** 4266,4272 ****
> >     if (!STMT_VINFO_DATA_REF (stmt_info))
> >       return false;
> >   
> > !   negative = tree_int_cst_compare (DR_STEP (dr), size_zero_node) < 0;
> >     if (negative && ncopies > 1)
> >       {
> >         if (vect_print_dump_info (REPORT_DETAILS))
> > --- 4268,4277 ----
> >     if (!STMT_VINFO_DATA_REF (stmt_info))
> >       return false;
> >   
> > !   negative = tree_int_cst_compare (loop && nested_in_vect_loop_p (loop, 
> > stmt)
> > !                              ? STMT_VINFO_DR_STEP (stmt_info)
> > !                              : DR_STEP (dr),
> > !                              size_zero_node) < 0;
> 
> vectorizable_loop, unlike vectorizable_store, has nested_in_vect_loop
> bool flag, so you could just test that instead of
> loop && nested_in_vect_loop_p (loop, stmt) above and below.

Fixed as follows.

Richard.

2012-02-21  Richard Guenther  <rguent...@suse.de>

        * tree-vect-stmts.c (vectorizable_load): Use pre-computed
        nested_in_vect_loop.

Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c       (revision 184396)
+++ gcc/tree-vect-stmts.c       (working copy)
@@ -4268,7 +4268,7 @@ vectorizable_load (gimple stmt, gimple_s
   if (!STMT_VINFO_DATA_REF (stmt_info))
     return false;
 
-  negative = tree_int_cst_compare (loop && nested_in_vect_loop_p (loop, stmt)
+  negative = tree_int_cst_compare (nested_in_vect_loop
                                   ? STMT_VINFO_DR_STEP (stmt_info)
                                   : DR_STEP (dr),
                                   size_zero_node) < 0;
@@ -4658,7 +4658,7 @@ vectorizable_load (gimple stmt, gimple_s
      This can only occur when vectorizing memory accesses in the inner-loop
      nested within an outer-loop that is being vectorized.  */
 
-  if (loop && nested_in_vect_loop_p (loop, stmt)
+  if (nested_in_vect_loop
       && (TREE_INT_CST_LOW (STMT_VINFO_DR_STEP (stmt_info))
          % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0))
     {

Reply via email to