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

--- Comment #15 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:cee985872c4976c6253c9caeae476760fcf18bec

commit r17-1543-gcee985872c4976c6253c9caeae476760fcf18bec
Author: Souradipto Das <[email protected]>
Date:   Mon Jun 8 09:15:24 2026 +0530

    tree-optimization: Add bitop reduction simplifications against zero

    This patch introduces a simplification rule in match.pd to reduce bitwise
    expressions against zero. Specifically, it simplifies patterns where a
    variable checked against zero is combined via bitwise AND/OR with a
compounded
    bitwise OR check against zero.

            PR tree-optimization/125442

    gcc/ChangeLog:

            * match.pd: Add simplification rules for
            (a == 0) | ((a | b) == 0) -> (a == 0) and
            (a != 0) & ((a | b) != 0) -> (a != 0).

    gcc/testsuite/ChangeLog:

            * gcc.dg/int-bwise-opt-3.c: New test.
            * gcc.dg/int-bwise-opt-4.c: New test.

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

Reply via email to