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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Philipp Tomsich <ptoms...@gcc.gnu.org>:

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

commit r15-3866-ga88d6c6d777ad7c9235e2e620318f26e5347e50a
Author: Konstantinos Eleftheriou <konstantinos.elefther...@vrull.eu>
Date:   Wed Aug 7 17:54:30 2024 +0200

    match: Fix A || B not optimized to true when !B implies A [PR114326]

    In expressions like (a != b || ((a ^ b) & c) == d) and
    (a != b || (a ^ b) == c), (a ^ b) is folded to false.
    In the equivalent expressions (((a ^ b) & c) == d || a != b) and
    ((a ^ b) == c || a != b) this is not happening.

    This patch adds the following simplifications in match.pd:
    ((a ^ b) & c) cmp d || a != b --> 0 cmp d || a != b
    (a ^ b) cmp c || a != b --> 0 cmp c || a != b

            PR tree-optimization/114326

    gcc/ChangeLog:

            * match.pd: Add two patterns to fold a ^ b to 0, when a == b.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/fold-xor-and-or.c: New test.
            * gcc.dg/tree-ssa/fold-xor-or.c: New test.

    Tested-by: Christoph Müllner <christoph.muell...@vrull.eu>
    Signed-off-by: Philipp Tomsich <philipp.toms...@vrull.eu>
    Signed-off-by: Konstantinos Eleftheriou <konstantinos.elefther...@vrull.eu>
  • [Bug tree-optimization/114326] ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to