diff options
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index f2f0dc5..6fddd3a 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -698,6 +698,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) tree base, base_addr; tree misalign = NULL_TREE; tree aligned_to; + tree step; unsigned HOST_WIDE_INT alignment; if (dump_enabled_p ()) @@ -828,16 +829,20 @@ vect_compute_data_ref_alignment (struct data_reference *dr) DR_VECT_AUX (dr)->base_element_aligned = true; } + if (loop && nested_in_vect_loop_p (loop, stmt)) + step = STMT_VINFO_DR_STEP (stmt_info); + else + step = DR_STEP (dr); /* If this is a backward running DR then first access in the larger vectype actually is N-1 elements before the address in the DR. Adjust misalign accordingly. */ - if (tree_int_cst_sgn (DR_STEP (dr)) < 0) + if (tree_int_cst_sgn (step) < 0) { tree offset = ssize_int (TYPE_VECTOR_SUBPARTS (vectype) - 1); /* DR_STEP(dr) is the same as -TYPE_SIZE of the scalar type, otherwise we wouldn't be here. */ - offset = fold_build2 (MULT_EXPR, ssizetype, offset, DR_STEP (dr)); - /* PLUS because DR_STEP was negative. */ + offset = fold_build2 (MULT_EXPR, ssizetype, offset, step); + /* PLUS because STEP was negative. */ misalign = size_binop (PLUS_EXPR, misalign, offset); } |