diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-03-24 10:52:34 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-03-24 10:52:34 +0000 |
commit | a199d5e74bf37ee4306c70a03c6c58f9935d54c3 (patch) | |
tree | 18226202d3160ebeb2ae161ed993f2ad1dc5e749 /gcc/tree-vect-data-refs.c | |
parent | 19efbf0f53762e41be3b5fbdbc46e5b4e2c0c958 (diff) | |
download | gcc-a199d5e74bf37ee4306c70a03c6c58f9935d54c3.zip gcc-a199d5e74bf37ee4306c70a03c6c58f9935d54c3.tar.gz gcc-a199d5e74bf37ee4306c70a03c6c58f9935d54c3.tar.bz2 |
Use SCEV information when aligning for vectorisation (PR 84005)
This PR is another regression caused by the removal of the simple_iv
check in dr_analyze_innermost for BB analysis. Without splitting out
the step, we weren't able to find an underlying object whose alignment
could be increased.
As with PR81635, I think the simple_iv was only handling one special
case of something that ought to be more general. The more general
thing here is that if the address can be analysed as a scalar
evolution, and if all updates preserve alignment N, it's possible
to align the address to N by increasing the alignment of the base
object to N. That applies also to outer loops, and to both loop
and BB analysis.
I wasn't sure where the new functions ought to live, but tree-data-ref.c
seemed OK since (a) that already does scev analysis on addresses and
(b) you'd want to use dr_analyze_innermost first if you were analysing
a reference.
2018-03-24 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/84005
* tree-data-ref.h (get_base_for_alignment): Declare.
* tree-data-ref.c (get_base_for_alignment_1): New function.
(get_base_for_alignment): Likewise.
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use
get_base_for_alignment to find a suitable base object, instead
of always using drb->base_address.
gcc/testsuite/
PR tree-optimization/84005
* gcc.dg/vect/bb-slp-1.c: Make sure there is no message about
failing to force the alignment.
From-SVN: r258833
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index c009498..ce24387 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -957,11 +957,11 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (base_alignment < vector_alignment) { - tree base = drb->base_address; - if (TREE_CODE (base) == ADDR_EXPR) - base = TREE_OPERAND (base, 0); - if (!vect_can_force_dr_alignment_p (base, - vector_alignment * BITS_PER_UNIT)) + unsigned int max_alignment; + tree base = get_base_for_alignment (drb->base_address, &max_alignment); + if (max_alignment < vector_alignment + || !vect_can_force_dr_alignment_p (base, + vector_alignment * BITS_PER_UNIT)) { if (dump_enabled_p ()) { |