[Bug tree-optimization/126748] a/b -> 0 if it is known that a < b (for non-negative)

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

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

https://gcc.gnu.org/g:53b803a0d48df023a11231f9c43917ca9e33279d

commit r17-3335-g53b803a0d48df023a11231f9c43917ca9e33279d
Author: Daniel Barboza <[email protected]>
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.
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.