On 8/7/2026 1:19 AM, Andrea Pinski wrote:
When I was looking into fixing tree_expr_nonnegative_p not to be recusive,
we should have tree_expr_nonnegative_p use the ranger.
I also didn't realize I wrote this patch before so this is
the updated version of the already approved:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634205.html
Updated for the review comments.

Note testsuite/g++.dg/ipa/pure-const-3.C testcase will always fail as we can
use the fact the argument is always non-negative in many different places now.
Since there is no way to test it, let's remove the testcase.

Bootstrapped and tested on x86_64-linux-gnu.

Changes since v1:
* Use get_range_query instead of the global range.
Update the wording on pr80776-1.c testcase and add new testcase without dom.

        PR tree-optimization/111959

gcc/ChangeLog:

        * fold-const.cc (tree_single_nonnegative_p): Use the range to see
        if the SSA_NAME was nonnegative.

gcc/testsuite/ChangeLog:

        * gcc.dg/pr80776-1.c: xfail and update comment.
        * gcc.dg/pr80776-1a.c: New test.
        * gcc.dg/tree-ssa/forwprop-44.c: New test.
        * testsuite/g++.dg/ipa/pure-const-3.C: Remove.

Signed-off-by: Andrea Pinski <[email protected]>
OK
jeff

Reply via email to