[Bug tree-optimization/126743] If a != b, then (a | b) (==,!=) 0 -> (false, true)

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126743

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Daniel Barboza <[email protected]>:

https://gcc.gnu.org/g:9a54dbee11c890546b0bad8e3022296f02449181

commit r17-3336-g9a54dbee11c890546b0bad8e3022296f02449181
Author: Daniel Barboza <[email protected]>
Date:   Wed Aug 12 06:25:15 2026 -0300

    range-op: add VREL_NE relation effect for bit_ior [PR126743]

    Given a bit_ior in the format A | B, if we know for certain that
    A != B then we can infer that A | B will always be nonzero.

    Bootstrapped and regression tested in x86_64, aarch64 and riscv64.

            PR tree-optimization/126743

    gcc/ChangeLog:

            * range-op-mixed.h: declare.
            * range-op.cc (operator_bitwise_or::op1_op2_relation_effect):
            add op1 NE op2 relation range for op1 | op2 as nonzero.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr126743.c: New test.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.