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

--- Comment #10 from Jeffrey A. Law <law at gcc dot gnu.org> ---
This patch fixed the bug:

commit 54e9c0be90fa87767d57ff682e044959feb754f2 (HEAD)
Author: Robin Dapp <[email protected]>
Date:   Sat Nov 22 20:53:25 2025 +0100

    vect: Use start value in vect_load_perm_consecutive_p [PR122797].

    vect_load_perm_consecutive_p is used in a spot where we want to check
    that a permutation is consecutive and starting with 0.  Originally I
    wanted to add this way of checking to the function but what I ended
    up with is checking whether the given permutation is consecutive
    starting from a certain index.  Thus, we will return true for
    e.g. {1, 2, 3} which doesn't make sense in the context of the PR.
    This patch corrects it.

            PR tree-optimization/122797

    gcc/ChangeLog:

            * tree-vect-slp.cc (vect_load_perm_consecutive_p): Check
            permutation start at element 0 with value instead of starting
            at a given element.
            (vect_optimize_slp_pass::remove_redundant_permutations):
            Use start value of 0.
            * tree-vectorizer.h (vect_load_perm_consecutive_p): Set default
            value to to UINT_MAX.

    gcc/testsuite/ChangeLog:

            * gcc.dg/vect/pr122797.c: New test.

Reply via email to