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

--- Comment #5 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:788fa7c613177b35e6c1e5098b8931480b4f0853

commit r16-4553-g788fa7c613177b35e6c1e5098b8931480b4f0853
Author: Richard Biener <[email protected]>
Date:   Wed Oct 22 09:41:15 2025 +0200

    tree-optimization/122371 - ICE with reduction chain and fold-left reduction

    The fold-left reduction transform relies on preserving the scalar
    cycle PHI.  The following rewrites how we connect this to the
    involved stmt-infos instead of relying on (the actually bogus for
    reduction chain) scalar stmts in SLP nodes more than absolutely
    necessary.  This also makes sure to not re-associate to form a
    reduction chain when a fold-left reduction is required.

            PR tree-optimization/122371
            * tree-vect-loop.cc (vectorize_fold_left_reduction): Get
            to the scalar def to replace via the scalar PHI backedge def.
            * tree-vect-slp.cc (vect_analyze_slp_reduc_chain): Do not
            re-associate to for a reduction chain if a fold-left
            reduction is required.

            * gcc.dg/vect/vect-pr122371.c: New testcase.

Reply via email to