On 5/27/2021 2:55 AM, Aldy Hernandez via Gcc-patches wrote:
Right now, range_of_expr only works with constants, SSA names, and pointers. Anything else gets returned as VARYING. This patch adds the capability to deal with arbitrary expressions, inasmuch as these tree codes are implemented in range-ops.cc. This will give us the ability to ask for the range of any tree expression, not just constants and SSA names, with range_of_expr(). This is a more generic implementation of determine_value_range in VRP. A follow-up patch will remove all uses of it in favor of the range_query API. Tested on x86-64 Linux. OK? gcc/ChangeLog: * function-tests.c (test_ranges): Call gimple_range_tests. * gimple-range-gori.cc (gori_compute::expr_range_at_stmt): Use get_global_range_query instead of get_tree_range. * gimple-range.cc (fur_source::get_operand): Add argument to get_tree_range. (get_arith_expr_range): New. (get_tree_range): Add gimple and range_query arguments. Call get_arith_expr_range. (gimple_ranger::range_of_expr): Add argument to get_tree_range. Include gimple-range-tests.cc. * gimple-range.h (get_tree_range): Add argument. * selftest.h (gimple_range_tests): New. * value-query.cc (global_range_query::range_of_expr): Add argument to get_tree_range. * vr-values.c (vr_values::range_of_expr): Same. * gimple-range-tests.cc: New file.
Both patches in this series are fine. Thanks, Jeff