[Bug tree-optimization/125735] non-negative x in `1/x should be converted to `x == 1` early
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 10 01:49:13 GMT 2026
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 <kael@gcc.gnu.org>:
https://gcc.gnu.org/g:e8f4e91989f0b57463f1b726f94344ddbe2bb128
commit r17-3173-ge8f4e91989f0b57463f1b726f94344ddbe2bb128
Author: Kael Andrew Alonzo Franco <kaelfandrew@gmail.com>
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 <kaelfandrew@gmail.com>
More information about the Gcc-bugs
mailing list