aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2021-05-19 18:44:08 +0200
committerAldy Hernandez <aldyh@redhat.com>2021-05-26 21:31:27 +0200
commit45f4e2b01b82c72b3a11ff4ad184d7edcf0e63d4 (patch)
tree4ded2cb7fa2fbf922e5258cee4d0202c511ca68a /gcc/match.pd
parentfe9a499cb8775cfbcea356ab0cae5c365971cf86 (diff)
downloadgcc-45f4e2b01b82c72b3a11ff4ad184d7edcf0e63d4.zip
gcc-45f4e2b01b82c72b3a11ff4ad184d7edcf0e63d4.tar.gz
gcc-45f4e2b01b82c72b3a11ff4ad184d7edcf0e63d4.tar.bz2
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.
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index dd73081..b60e270 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -663,11 +663,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(with
{
bool overflowed = true;
- wide_int wmin0, wmax0, wmin1, wmax1;
+ value_range vr0, vr1;
if (INTEGRAL_TYPE_P (type)
- && get_range_info (@0, &wmin0, &wmax0) == VR_RANGE
- && get_range_info (@1, &wmin1, &wmax1) == VR_RANGE)
+ && get_global_range_query ()->range_of_expr (vr0, @0)
+ && get_global_range_query ()->range_of_expr (vr1, @1)
+ && vr0.kind () == VR_RANGE
+ && vr1.kind () == VR_RANGE)
{
+ wide_int wmin0 = vr0.lower_bound ();
+ wide_int wmax0 = vr0.upper_bound ();
+ wide_int wmin1 = vr1.lower_bound ();
+ wide_int wmax1 = vr1.upper_bound ();
/* If the multiplication can't overflow/wrap around, then
it can be optimized too. */
wi::overflow_type min_ovf, max_ovf;
@@ -2509,9 +2515,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
= wide_int::from (wi::to_wide (@1), TYPE_PRECISION (inner_type),
TYPE_SIGN (inner_type));
- wide_int wmin0, wmax0;
- if (get_range_info (@0, &wmin0, &wmax0) == VR_RANGE)
+ value_range vr;
+ if (get_global_range_query ()->range_of_expr (vr, @0)
+ && vr.kind () == VR_RANGE)
{
+ wide_int wmin0 = vr.lower_bound ();
+ wide_int wmax0 = vr.upper_bound ();
wi::add (wmin0, w1, TYPE_SIGN (inner_type), &min_ovf);
wi::add (wmax0, w1, TYPE_SIGN (inner_type), &max_ovf);
}