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

--- Comment #5 from CVS 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:cc155ff9c38848a8e6a7125dd0b66ac0aef47880

commit r14-1599-gcc155ff9c38848a8e6a7125dd0b66ac0aef47880
Author: Andrew Pinski <apin...@marvell.com>
Date:   Mon Jun 5 19:12:43 2023 -0700

    For the `-A CMP -B -> B CMP A` pattern allow EQ/NE for all integer types

    I noticed while looking at some code generation issue, that forwprop
    was not handling `-a == 0` for unsigned types and I was confused why
    it was not.
    r6-1814-g66e1cacf608045 removed these from fold because they
    were supposed to be already handled by the match.pd patterns
    but it was missed that the match.pd patterns checked
    TYPE_OVERFLOW_UNDEFINED while fold didn't do that for NE/EQ.
    This patch removes the restriction on NE/EQ on TYPE_OVERFLOW_UNDEFINED.

    OK? Bootstrapped and tested on x86_64-linux-gnu.

    gcc/ChangeLog:

            PR tree-optimization/110134
            * match.pd (-A CMP -B -> B CMP A): Allow EQ/NE for all integer
            types.
            (-A CMP CST -> B CMP (-CST)): Likewise.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/110134
            * gcc.dg/tree-ssa/negneq-1.c: New test.
            * gcc.dg/tree-ssa/negneq-2.c: New test.
            * gcc.dg/tree-ssa/negneq-3.c: New test.
            * gcc.dg/tree-ssa/negneq-4.c: New test.

Reply via email to