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

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

https://gcc.gnu.org/g:24e96a7911669fc81febcf887b443c8aef15a4cc

commit r17-5963-g24e96a7911669fc81febcf887b443c8aef15a4cc
Author: Naveen <[email protected]>
Date:   Wed Nov 4 20:09:17 2026 -0800

    tree-optimization: tighten unsigned-add range via no-overflow relation
[PR127101]

    When lhs = op1 + op2 and the relation lhs >= op1 is known, no unsigned
    overflow can have occurred and so lhs >= op2.  If op2's lower bound is
    positive this lets us tighten the computed range of lhs to [op2_lb,
TYPE_MAX].
    The symmetric case (lhs >= op2, op1_lb > 0) is handled analogously.

    Add operator_plus::fold_range to apply this intersection and thread
    the lhs-op1 / lhs-op2 relation_trio through the four fold_range
    call-sites in gori_compute::refine_using_relation so the tightening
    actually fires during GORI refinement.

    gcc/ChangeLog:

            PR tree-optimization/127101
            * range-op-mixed.h (operator_plus): Add using declaration for
            range_operator::fold_range; declare fold_range override.
            * range-op.cc (operator_plus::fold_range): New.
            * gimple-range-gori.cc (gori_compute::refine_using_relation):
            Pass lhs_op1/lhs_op2 relation to fold_range call-sites.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/127101
            * gcc.dg/tree-ssa/pr127101.c: New test.

    Signed-off-by: Naveen <[email protected]>

Reply via email to