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. > if (negative && ncopies > 1) > { > if (vect_print_dump_info (REPORT_DETAILS)) > *************** vectorizable_load (gimple stmt, gimple_s > *** 4654,4660 **** > nested within an outer-loop that is being vectorized. */ > > if (loop && nested_in_vect_loop_p (loop, stmt) > ! && (TREE_INT_CST_LOW (DR_STEP (dr)) > % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)) > { > gcc_assert (alignment_support_scheme != > dr_explicit_realign_optimized); > --- 4659,4665 ---- > nested within an outer-loop that is being vectorized. */ > > if (loop && nested_in_vect_loop_p (loop, stmt) > ! && (TREE_INT_CST_LOW (STMT_VINFO_DR_STEP (stmt_info)) > % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)) > { > gcc_assert (alignment_support_scheme != > dr_explicit_realign_optimized); Jakub