[Bug tree-optimization/125735] non-negative x in `1/x should be converted to `x == 1` early

"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=125735

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

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

commit r17-3173-ge8f4e91989f0b57463f1b726f94344ddbe2bb128
Author: Kael Andrew Alonzo Franco <[email protected]>
Date:   Sun Aug 9 21:47:58 2026 -0400

    match: 1 / X -> X == 1 for positive X. [PR125735]

    TYPE_UNSIGNED (type) doesn't cover positive signed types
    so use tree_expr_nonnegative_p ().

    Bootstrapped and tested on x86_64-pc-linux-gnu.

            PR tree-optimization/125735

    gcc/ChangeLog:

            * match.pd: 1 / X -> X == 1 for positive X.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr125735.c: New test.

    Signed-off-by: Kael Andrew Franco <[email protected]>
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.