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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <tnfch...@gcc.gnu.org>:

https://gcc.gnu.org/g:68326d5d1a593dc0bf098c03aac25916168bc5a9

commit r15-6807-g68326d5d1a593dc0bf098c03aac25916168bc5a9
Author: Alex Coplan <alex.cop...@arm.com>
Date:   Mon Mar 11 13:09:10 2024 +0000

    vect: Force alignment peeling to vectorize more early break loops
[PR118211]

    This allows us to vectorize more loops with early exits by forcing
    peeling for alignment to make sure that we're guaranteed to be able to
    safely read an entire vector iteration without crossing a page boundary.

    To make this work for VLA architectures we have to allow compile-time
    non-constant target alignments.  We also have to override the result of
    the target's preferred_vector_alignment hook if it isn't a power-of-two
    multiple of the TYPE_SIZE of the chosen vector type.

    gcc/ChangeLog:

            PR tree-optimization/118211
            PR tree-optimization/116126
            * tree-vect-data-refs.cc (vect_analyze_early_break_dependences):
            Set need_peeling_for_alignment flag on read DRs instead of
            failing vectorization.  Punt on gathers.
            (dr_misalignment): Handle non-constant target alignments.
            (vect_compute_data_ref_alignment): If need_peeling_for_alignment
            flag is set on the DR, then override the target alignment chosen
            by the preferred_vector_alignment hook to choose a safe
            alignment.
            (vect_supportable_dr_alignment): Override
            support_vector_misalignment hook if need_peeling_for_alignment
            is set on the DR: in this case we must return
            dr_unaligned_unsupported in order to force peeling.
            * tree-vect-loop-manip.cc (vect_do_peeling): Allow prolog
            peeling by a compile-time non-constant amount.
            * tree-vectorizer.h (dr_vec_info): Add new flag
            need_peeling_for_alignment.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/118211
            PR tree-optimization/116126
            * gcc.dg/tree-ssa/cunroll-13.c: Don't vectorize.
            * gcc.dg/tree-ssa/cunroll-14.c: Likewise.
            * gcc.dg/unroll-6.c: Likewise.
            * gcc.dg/tree-ssa/gen-vect-28.c: Likewise.
            * gcc.dg/vect/vect-104.c: Expect to vectorize.
            * gcc.dg/vect/vect-early-break_108-pr113588.c: Likewise.
            * gcc.dg/vect/vect-early-break_109-pr113588.c: Likewise.
            * gcc.dg/vect/vect-early-break_110-pr113467.c: Likewise.
            * gcc.dg/vect/vect-early-break_3.c: Likewise.
            * gcc.dg/vect/vect-early-break_65.c: Likewise.
            * gcc.dg/vect/vect-early-break_8.c: Likewise.
            * gfortran.dg/vect/vect-5.f90: Likewise.
            * gfortran.dg/vect/vect-8.f90: Likewise.
            * gcc.dg/vect/vect-switch-search-line-fast.c:

    Co-Authored-By: Tamar Christina <tamar.christ...@arm.com>

Reply via email to