aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-tests.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-03-02 16:34:46 +0100
committerAldy Hernandez <aldyh@redhat.com>2023-05-01 08:33:12 +0200
commitcb779afeff204fdb278e55006ea7d269a4606d85 (patch)
tree15ca32f9f066f6d052a21e88fae64755659930b7 /gcc/gimple-range-tests.cc
parent612d373005ad239001fd61f32950cb146e1084bc (diff)
downloadgcc-cb779afeff204fdb278e55006ea7d269a4606d85.zip
gcc-cb779afeff204fdb278e55006ea7d269a4606d85.tar.gz
gcc-cb779afeff204fdb278e55006ea7d269a4606d85.tar.bz2
Conversion to irange wide_int API.
This converts the irange API to use wide_ints exclusively, along with its users. This patch will slow down VRP, as there will be more useless wide_int to tree conversions. However, this slowdown is only temporary, as a follow-up patch will convert the internal representation of iranges to wide_ints for a net overall gain in performance. gcc/ChangeLog: * fold-const.cc (expr_not_equal_to): Convert to irange wide_int API. * gimple-fold.cc (size_must_be_zero_p): Same. * gimple-loop-versioning.cc (loop_versioning::prune_loop_conditions): Same. * gimple-range-edge.cc (gcond_edge_range): Same. (gimple_outgoing_range::calc_switch_ranges): Same. * gimple-range-fold.cc (adjust_imagpart_expr): Same. (adjust_realpart_expr): Same. (fold_using_range::range_of_address): Same. (fold_using_range::relation_fold_and_or): Same. * gimple-range-gori.cc (gori_compute::gori_compute): Same. (range_is_either_true_or_false): Same. * gimple-range-op.cc (cfn_toupper_tolower::get_letter_range): Same. (cfn_clz::fold_range): Same. (cfn_ctz::fold_range): Same. * gimple-range-tests.cc (class test_expr_eval): Same. * gimple-ssa-warn-alloca.cc (alloca_call_type): Same. * ipa-cp.cc (ipa_value_range_from_jfunc): Same. (propagate_vr_across_jump_function): Same. (decide_whether_version_node): Same. * ipa-prop.cc (ipa_get_value_range): Same. * ipa-prop.h (ipa_range_set_and_normalize): Same. * range-op.cc (get_shift_range): Same. (value_range_from_overflowed_bounds): Same. (value_range_with_overflow): Same. (create_possibly_reversed_range): Same. (equal_op1_op2_relation): Same. (not_equal_op1_op2_relation): Same. (lt_op1_op2_relation): Same. (le_op1_op2_relation): Same. (gt_op1_op2_relation): Same. (ge_op1_op2_relation): Same. (operator_mult::op1_range): Same. (operator_exact_divide::op1_range): Same. (operator_lshift::op1_range): Same. (operator_rshift::op1_range): Same. (operator_cast::op1_range): Same. (operator_logical_and::fold_range): Same. (set_nonzero_range_from_mask): Same. (operator_bitwise_or::op1_range): Same. (operator_bitwise_xor::op1_range): Same. (operator_addr_expr::fold_range): Same. (pointer_plus_operator::wi_fold): Same. (pointer_or_operator::op1_range): Same. (INT): Same. (UINT): Same. (INT16): Same. (UINT16): Same. (SCHAR): Same. (UCHAR): Same. (range_op_cast_tests): Same. (range_op_lshift_tests): Same. (range_op_rshift_tests): Same. (range_op_bitwise_and_tests): Same. (range_relational_tests): Same. * range.cc (range_zero): Same. (range_nonzero): Same. * range.h (range_true): Same. (range_false): Same. (range_true_and_false): Same. * tree-data-ref.cc (split_constant_offset_1): Same. * tree-ssa-loop-ch.cc (entry_loop_condition_is_static): Same. * tree-ssa-loop-unswitch.cc (struct unswitch_predicate): Same. (find_unswitching_predicates_for_bb): Same. * tree-ssa-phiopt.cc (value_replacement): Same. * tree-ssa-threadbackward.cc (back_threader::find_taken_edge_cond): Same. * tree-ssanames.cc (ssa_name_has_boolean_range): Same. * tree-vrp.cc (find_case_label_range): Same. * value-query.cc (range_query::get_tree_range): Same. * value-range.cc (irange::set_nonnegative): Same. (frange::contains_p): Same. (frange::singleton_p): Same. (frange::internal_singleton_p): Same. (irange::irange_set): Same. (irange::irange_set_1bit_anti_range): Same. (irange::irange_set_anti_range): Same. (irange::set): Same. (irange::operator==): Same. (irange::singleton_p): Same. (irange::contains_p): Same. (irange::set_range_from_nonzero_bits): Same. (DEFINE_INT_RANGE_INSTANCE): Same. (INT): Same. (UINT): Same. (SCHAR): Same. (UINT128): Same. (UCHAR): Same. (range): New. (tree_range): New. (range_int): New. (range_uint): New. (range_uint128): New. (range_uchar): New. (range_char): New. (build_range3): Convert to irange wide_int API. (range_tests_irange3): Same. (range_tests_int_range_max): Same. (range_tests_strict_enum): Same. (range_tests_misc): Same. (range_tests_nonzero_bits): Same. (range_tests_nan): Same. (range_tests_signed_zeros): Same. * value-range.h (Value_Range::Value_Range): Same. (irange::set): Same. (irange::nonzero_p): Same. (irange::contains_p): Same. (range_includes_zero_p): Same. (irange::set_nonzero): Same. (irange::set_zero): Same. (contains_zero_p): Same. (frange::contains_p): Same. * vr-values.cc (simplify_using_ranges::op_with_boolean_value_range_p): Same. (bounds_of_var_in_loop): Same. (simplify_using_ranges::legacy_fold_cond_overflow): Same.
Diffstat (limited to 'gcc/gimple-range-tests.cc')
-rw-r--r--gcc/gimple-range-tests.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/gimple-range-tests.cc b/gcc/gimple-range-tests.cc
index 7e4d234..c325a7b 100644
--- a/gcc/gimple-range-tests.cc
+++ b/gcc/gimple-range-tests.cc
@@ -35,7 +35,9 @@ public:
// [5,10] + [15,20] => [20, 30]
tree expr = fold_build2 (PLUS_EXPR, type, op0, op1);
- int_range<2> expect (build_int_cst (type, 20), build_int_cst (type, 30));
+ int_range<1> expect (type,
+ wi::shwi (20, TYPE_PRECISION (type)),
+ wi::shwi (30, TYPE_PRECISION (type)));
int_range_max r;
ASSERT_TRUE (range_of_expr (r, expr));
@@ -45,14 +47,15 @@ public:
virtual bool range_of_expr (vrange &v, tree expr, gimple * = NULL) override
{
irange &r = as_a <irange> (v);
+ unsigned prec = TYPE_PRECISION (type);
if (expr == op0)
{
- r.set (build_int_cst (type, 5), build_int_cst (type, 10));
+ r.set (type, wi::shwi (5, prec), wi::shwi (10, prec));
return true;
}
if (expr == op1)
{
- r.set (build_int_cst (type, 15), build_int_cst (type, 20));
+ r.set (type, wi::shwi (15, prec), wi::shwi (20, prec));
return true;
}
return gimple_ranger::range_of_expr (r, expr);