From 45f4e2b01b82c72b3a11ff4ad184d7edcf0e63d4 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Wed, 19 May 2021 18:44:08 +0200 Subject: Convert remaining passes to get_range_query. This patch converts the remaining users of get_range_info and get_ptr_nonnull to the get_range_query API. No effort was made to move passes away from VR_ANTI_RANGE, or any other use of deprecated methods. This was a straight up conversion to the new API, nothing else. gcc/ChangeLog: * builtins.c (check_nul_terminated_array): Convert to get_range_query. (expand_builtin_strnlen): Same. (determine_block_size): Same. * fold-const.c (expr_not_equal_to): Same. * gimple-fold.c (size_must_be_zero_p): Same. * gimple-match-head.c: Include gimple-range.h. * gimple-pretty-print.c (dump_ssaname_info): Convert to get_range_query. * gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range): Same. * graphite-sese-to-poly.c (add_param_constraints): Same. * internal-fn.c (get_min_precision): Same. * ipa-fnsummary.c (set_switch_stmt_execution_predicate): Same. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Same. * match.pd: Same. * tree-data-ref.c (split_constant_offset): Same. (dr_step_indicator): Same. * tree-dfa.c (get_ref_base_and_extent): Same. * tree-scalar-evolution.c (iv_can_overflow_p): Same. * tree-ssa-loop-niter.c (refine_value_range_using_guard): Same. (determine_value_range): Same. (record_nonwrapping_iv): Same. (infer_loop_bounds_from_signedness): Same. (scev_var_range_cant_overflow): Same. * tree-ssa-phiopt.c (two_value_replacement): Same. * tree-ssa-pre.c (insert_into_preds_of_block): Same. * tree-ssa-reassoc.c (optimize_range_tests_to_bit_test): Same. * tree-ssa-strlen.c (handle_builtin_stxncpy_strncat): Same. (get_range): Same. (dump_strlen_info): Same. (set_strlen_range): Same. (maybe_diag_stxncpy_trunc): Same. (get_len_or_size): Same. (handle_integral_assign): Same. * tree-ssa-structalias.c (find_what_p_points_to): Same. * tree-ssa-uninit.c (find_var_cmp_const): Same. * tree-switch-conversion.c (bit_test_cluster::emit): Same. * tree-vect-patterns.c (vect_get_range_info): Same. (vect_recog_divmod_pattern): Same. * tree-vrp.c (intersect_range_with_nonzero_bits): Same. (register_edge_assert_for_2): Same. (determine_value_range_1): Same. * tree.c (get_range_pos_neg): Same. * vr-values.c (vr_values::get_lattice_entry): Same. (vr_values::update_value_range): Same. (simplify_conversion_using_ranges): Same. --- gcc/tree-data-ref.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'gcc/tree-data-ref.c') diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index e6dd5f1..09d4667 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1035,14 +1035,23 @@ split_constant_offset (tree exp, tree *var, tree *off, value_range *exp_range, *exp_range = type; if (code == SSA_NAME) { - wide_int var_min, var_max; - value_range_kind vr_kind = get_range_info (exp, &var_min, &var_max); + value_range vr; + get_range_query (cfun)->range_of_expr (vr, exp); + if (vr.undefined_p ()) + vr.set_varying (TREE_TYPE (exp)); + wide_int var_min = wi::to_wide (vr.min ()); + wide_int var_max = wi::to_wide (vr.max ()); + value_range_kind vr_kind = vr.kind (); wide_int var_nonzero = get_nonzero_bits (exp); vr_kind = intersect_range_with_nonzero_bits (vr_kind, &var_min, &var_max, var_nonzero, TYPE_SIGN (type)); - if (vr_kind == VR_RANGE) + /* This check for VR_VARYING is here because the old code + using get_range_info would return VR_RANGE for the entire + domain, instead of VR_VARYING. The new code normalizes + full-domain ranges to VR_VARYING. */ + if (vr_kind == VR_RANGE || vr_kind == VR_VARYING) *exp_range = value_range (type, var_min, var_max); } } @@ -6298,12 +6307,19 @@ dr_step_indicator (struct data_reference *dr, int useful_min) /* Get the range of values that the unconverted step actually has. */ wide_int step_min, step_max; + value_range vr; if (TREE_CODE (step) != SSA_NAME - || get_range_info (step, &step_min, &step_max) != VR_RANGE) + || !get_range_query (cfun)->range_of_expr (vr, step) + || vr.kind () != VR_RANGE) { step_min = wi::to_wide (TYPE_MIN_VALUE (type)); step_max = wi::to_wide (TYPE_MAX_VALUE (type)); } + else + { + step_min = vr.lower_bound (); + step_max = vr.upper_bound (); + } /* Check whether the unconverted step has an acceptable range. */ signop sgn = TYPE_SIGN (type); -- cgit v1.1