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.h | |
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.h')
-rw-r--r-- | gcc/value-range.h | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h index 633a234..b040e2f 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -635,8 +635,6 @@ Value_Range::supports_type_p (const_tree type) extern value_range_kind get_legacy_range (const irange &, tree &min, tree &max); extern void dump_value_range (FILE *, const vrange *); -extern bool vrp_val_is_min (const_tree); -extern bool vrp_val_is_max (const_tree); extern bool vrp_operand_equal_p (const_tree, const_tree); inline REAL_VALUE_TYPE frange_val_min (const_tree type); inline REAL_VALUE_TYPE frange_val_max (const_tree type); @@ -952,41 +950,18 @@ contains_zero_p (const irange &r) return r.contains_p (zero); } -// Return the maximum value for TYPE. - -inline tree -vrp_val_max (const_tree type) +inline wide_int +irange_val_min (const_tree type) { - if (INTEGRAL_TYPE_P (type)) - return TYPE_MAX_VALUE (type); - if (POINTER_TYPE_P (type)) - { - wide_int max = wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type)); - return wide_int_to_tree (const_cast<tree> (type), max); - } - if (frange::supports_p (type)) - { - REAL_VALUE_TYPE r = frange_val_max (type); - return build_real (const_cast <tree> (type), r); - } - return NULL_TREE; + gcc_checking_assert (irange::supports_p (type)); + return wi::min_value (TYPE_PRECISION (type), TYPE_SIGN (type)); } -// Return the minimum value for TYPE. - -inline tree -vrp_val_min (const_tree type) +inline wide_int +irange_val_max (const_tree type) { - if (INTEGRAL_TYPE_P (type)) - return TYPE_MIN_VALUE (type); - if (POINTER_TYPE_P (type)) - return build_zero_cst (const_cast<tree> (type)); - if (frange::supports_p (type)) - { - REAL_VALUE_TYPE r = frange_val_min (type); - return build_real (const_cast <tree> (type), r); - } - return NULL_TREE; + gcc_checking_assert (irange::supports_p (type)); + return wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type)); } inline |