diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2023-02-16 14:25:52 +0100 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2023-05-01 08:33:15 +0200 |
commit | 8b2181a415fda05c48a13f915cc42214462d19cb (patch) | |
tree | f567bc1fc45d338d1a073f989c2ad939eb600bdd /gcc/value-range.cc | |
parent | cb779afeff204fdb278e55006ea7d269a4606d85 (diff) | |
download | gcc-8b2181a415fda05c48a13f915cc42214462d19cb.zip gcc-8b2181a415fda05c48a13f915cc42214462d19cb.tar.gz gcc-8b2181a415fda05c48a13f915cc42214462d19cb.tar.bz2 |
Replace vrp_val* with wide_ints.
This patch removes all uses of vrp_val_{min,max} in favor for a
irange_val_* which are wide_int based. This will leave only one use
of vrp_val_* which returns trees in range_of_ssa_name_with_loop_info()
because it needs to work with non-integers (floats, etc). In a
follow-up patch, this function will also be cleaned up such that
vrp_val_* can be deleted.
The functions min_limit and max_limit in range-op.cc are now useless
as they're basically irange_val*. I didn't rename them yet to avoid
churn. I'll do it in a later patch.
gcc/ChangeLog:
* gimple-range-fold.cc (adjust_pointer_diff_expr): Rewrite with
irange_val*.
(vrp_val_max): New.
(vrp_val_min): New.
* gimple-range-op.cc (cfn_strlen::fold_range): Use irange_val_*.
* range-op.cc (max_limit): Same.
(min_limit): Same.
(plus_minus_ranges): Same.
(operator_rshift::op1_range): Same.
(operator_cast::inside_domain_p): Same.
* value-range.cc (vrp_val_is_max): Delete.
(vrp_val_is_min): Delete.
(range_tests_misc): Use irange_val_*.
* value-range.h (vrp_val_is_min): Delete.
(vrp_val_is_max): Delete.
(vrp_val_max): Delete.
(irange_val_min): New.
(vrp_val_min): Delete.
(irange_val_max): New.
* vr-values.cc (check_for_binary_op_overflow): Use irange_val_*.
Diffstat (limited to 'gcc/value-range.cc')
-rw-r--r-- | gcc/value-range.cc | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc index f214872..cf694cc 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -1990,31 +1990,6 @@ debug (const value_range &vr) fprintf (stderr, "\n"); } -/* Return whether VAL is equal to the maximum value of its type. - We can't do a simple equality comparison with TYPE_MAX_VALUE because - C typedefs and Ada subtypes can produce types whose TYPE_MAX_VALUE - is not == to the integer constant with the same value in the type. */ - -bool -vrp_val_is_max (const_tree val) -{ - tree type_max = vrp_val_max (TREE_TYPE (val)); - return (val == type_max - || (type_max != NULL_TREE - && operand_equal_p (val, type_max, 0))); -} - -/* Return whether VAL is equal to the minimum value of its type. */ - -bool -vrp_val_is_min (const_tree val) -{ - tree type_min = vrp_val_min (TREE_TYPE (val)); - return (val == type_min - || (type_min != NULL_TREE - && operand_equal_p (val, type_min, 0))); -} - /* Return true, if VAL1 and VAL2 are equal values for VRP purposes. */ bool @@ -2369,11 +2344,11 @@ range_tests_misc () // Test 1-bit signed integer union. // [-1,-1] U [0,0] = VARYING. tree one_bit_type = build_nonstandard_integer_type (1, 0); - tree one_bit_min = vrp_val_min (one_bit_type); - tree one_bit_max = vrp_val_max (one_bit_type); + wide_int one_bit_min = irange_val_min (one_bit_type); + wide_int one_bit_max = irange_val_max (one_bit_type); { - int_range<2> min = tree_range (one_bit_min, one_bit_min); - int_range<2> max = tree_range (one_bit_max, one_bit_max); + int_range<2> min = int_range<2> (one_bit_type, one_bit_min, one_bit_min); + int_range<2> max = int_range<2> (one_bit_type, one_bit_max, one_bit_max); max.union_ (min); ASSERT_TRUE (max.varying_p ()); } @@ -2382,8 +2357,8 @@ range_tests_misc () // Test inversion of 1-bit signed integers. { - int_range<2> min = tree_range (one_bit_min, one_bit_min); - int_range<2> max = tree_range (one_bit_max, one_bit_max); + int_range<2> min = int_range<2> (one_bit_type, one_bit_min, one_bit_min); + int_range<2> max = int_range<2> (one_bit_type, one_bit_max, one_bit_max); int_range<2> t; t = min; t.invert (); |