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

--- Comment #3 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:578002846620ed04192a4832e9f20b5c32816153

commit r15-5021-g578002846620ed04192a4832e9f20b5c32816153
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Fri Nov 1 20:06:30 2024 -0700

    VN: Handle `(a | b) !=/== 0` for predicates [PR117414]

    For `(a | b) == 0`, we can "assert" on the true edge that
    both `a == 0` and `b == 0` but nothing on the false edge.
    For `(a | b) != 0`, we can "assert" on the false edge that
    both `a == 0` and `b == 0` but nothing on the true edge.
    This adds that predicate and allows us to optimize f0, f1,
    and f2 in fre-predicated-[12].c.

    Changes since v1:
    * v2: Use vn_valueize. Also canonicalize the comparison
          at the begining of insert_predicates_for_cond for
          constants to be on the rhs. Return early for
          non-ssa names on the lhs (after canonicalization).

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/117414

    gcc/ChangeLog:

            * tree-ssa-sccvn.cc (insert_predicates_for_cond): Canonicalize the
comparison.
            Don't insert anything if lhs is not a SSA_NAME. Handle `(a | b)
!=/== 0`.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/fre-predicated-1.c: New test.
            * gcc.dg/tree-ssa/fre-predicated-2.c: New test.

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

Reply via email to