On 11/4/26 2:47 AM, Naveen wrote: > 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. > > Bootstrapped and regression-tested on x86_64 and Aarch64 with no new > failures.\
OK. Andrew
