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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <[email protected]>:

https://gcc.gnu.org/g:71466227eb89fd6b617a4409b213c376c1f333bc

commit r17-6878-g71466227eb89fd6b617a4409b213c376c1f333bc
Author: Richard Biener <[email protected]>
Date:   Fri Nov 27 16:49:20 2026 +0100

    tree-optimization/128626 - restrict TBAA check in vect dependence analysis
to read-before-write

    The following restricts the TBAA check in vectorizer dependence analysis to
    cases where the read precedes the write in scalar order and the vectorizer
    preserves this order.  Cross-iteration anti-dependences (WAR) between
    incompatible types are conforming on untyped memory because stores
dynamically
    change effective types, so a store preceding a load across iterations
cannot
    be ignored via TBAA (PR128626).  However, a read preceding a write is sound
    to disambiguate because any cross-iteration RAW dependence violates TBAA
    constraints, and the conforming WAR dependence is preserved by the
vectorizer
    emitting loads before stores.  In addition, do not apply this
disambiguation
    when accesses are nested in an inner loop during outer-loop vectorization,
    since inner loop iterations execute sequentially across all vector lanes
and
    can reorder writes before reads.

            PR tree-optimization/128626
            * tree-vect-data-refs.cc (vect_analyze_data_ref_dependence):
            Only apply TBAA disambiguation when the read precedes the write,
            scalar order is preserved, and accesses are not nested in an inner
            loop.

            * gcc.dg/vect/pr128626-1.c: New testcase.
            * gcc.dg/vect/pr128626-2.c: Likewise.

Reply via email to