[Bug middle-end/111959] tree_single_nonnegative_ could use tree_nonzero_bits for SSA_NAMES and int types
"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=111959 --- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:5af52562e3fb59bcecaa25ef834424e7f7076400 commit r17-3171-g5af52562e3fb59bcecaa25ef834424e7f7076400 Author: Andrea Pinski <[email protected]> Date: Thu Aug 6 20:03:46 2026 -0700 Improve tree_expr_nonnegative_p by using the ranger [PR111959] 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. * g++.dg/ipa/pure-const-3.C: Remove. Signed-off-by: Andrea Pinski <[email protected]>