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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:cd33e5ad1945f19b5b1b2429ee62d1b3c8919914

commit r17-1404-gcd33e5ad1945f19b5b1b2429ee62d1b3c8919914
Author: Andrew Pinski <[email protected]>
Date:   Thu Jun 4 18:16:44 2026 -0700

    cselim: Prevent cselim doing store sinking when there are loads in the
middle bb [PR125612]

    r17-1273-g391ee229b737eb added support for the case where the middle bb was
non-empty but
    with a trailing store. This meant if there was a load in the middle bb, it
might cause
    nontrapping to have the lhs in it. So we now need to check for a load in
the middle-bb
    to reject this case.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/125612

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (cond_store_replacement): For the case where
            lhs is "known" to be nontrapping make sure there are no loads in
            the middle bb.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr125612-1.c: New test.

    Signed-off-by: Andrew Pinski <[email protected]>

Reply via email to