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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

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

commit r15-5844-ge1009b3de2d05782ae1e0c62f9e81da14c4d6156
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Sat Nov 30 14:09:48 2024 -0800

    VN: Don't recurse on for the same value of `a != 0` [PR117859]

    Like r15-5063-g6e84a41622f56c, but this is for the `a != 0` case.
    After adding vn_valueize to the handle the `a ==/!= 0` case
    of insert_predicates_for_cond, it would go into an infinite loop
    as the Value number for a could be the same as what it
    is for the whole expression. This avoids that recursion so there is
    no infinite loop here.

    Note lim was introducing `bool_var2 = bool_var1 != 0` originally but
    with the gimple testcase in -2, there is no dependency on what passes
    before hand will do.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/117859

    gcc/ChangeLog:

            * tree-ssa-sccvn.cc (insert_predicates_for_cond): If the
            valueization for the new lhs for `lhs != 0`
            is the same as the old ones, don't recurse.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/pr117859-1.c: New test.
            * gcc.dg/torture/pr117859-2.c: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Reply via email to