https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84005

--- Comment #11 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Author: rsandifo
Date: Sat Mar 24 10:52:34 2018
New Revision: 258833

URL: https://gcc.gnu.org/viewcvs?rev=258833&root=gcc&view=rev
Log:
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.sandif...@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.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/vect/bb-slp-1.c
    trunk/gcc/tree-data-ref.c
    trunk/gcc/tree-data-ref.h
    trunk/gcc/tree-vect-data-refs.c

Reply via email to