[Bug tree-optimization/126748] a/b -> 0 if it is known that a < b (for non-negative)
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 17 12:24:41 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126748
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Daniel Barboza <dbarboza@gcc.gnu.org>:
https://gcc.gnu.org/g:53b803a0d48df023a11231f9c43917ca9e33279d
commit r17-3335-g53b803a0d48df023a11231f9c43917ca9e33279d
Author: Daniel Barboza <daniel.barboza@oss.qualcomm.com>
Date: Wed Aug 12 06:24:27 2026 -0300
range-op: add VREL_LT relation effect for div [PR126748]
Given A div B, if we know for certain that A and B are positive
and A < B, we can infer that A div B is zero.
Bootstrapped and regression tested in x86_64, aarch64 and riscv64.
PR tree-optimization/126748
gcc/ChangeLog:
* range-op.cc (class operator_div): declarations.
(operator_div::op1_op2_relation_effect): add op1/op2 relation
range equal zero for op1/op2 if op1 < op2 and both op1 and op2
are positives.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr126748.c: New test.
More information about the Gcc-bugs
mailing list