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

--- Comment #4 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:07800a565abd20814468a4f84a988e0d95bf30b5

commit r16-4534-g07800a565abd20814468a4f84a988e0d95bf30b5
Author: Andrew Pinski <[email protected]>
Date:   Mon Oct 20 15:48:43 2025 -0700

    match: Add support for convert `((signed)x) < 0` to `x >=
(unsigned)SIGNED_TYPE_MIN` while detecting min/max [PR110068]

    This copies the optimization which was done to fix PR 95699 to match
detection of MIN/MAX
    from minmax_replacement to match.
    This is another step in getting rid of minmax_replacement in phiopt.  There
are still a few
    more min/max detections that needs to be handled before the removal.
pr101024-1.c adds one
    example of that but since the testcase currently passes I didn't xfail it.

    pr110068-1.c adds a testcase which was not detected beforehand either.

    Changes since v1:
    * v2: Fix comment about how it is transformed.
          Use SIGNED_TYPE_MIN everywhere instead of mxing in SIGNED_TYPE_MAX
too.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/95699
            PR tree-optimization/101024
            PR tree-optimization/110068

    gcc/ChangeLog:

            * match.pd (`(type1)x CMP CST1 ? (type2)x : CST2`): Treat
            `(signed)x </>= 0` as `x >=/< SIGNED_TYPE_MIN`

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr101024-1.c: New test.
            * gcc.dg/tree-ssa/pr110068-1.c: New test.

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

Reply via email to