aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-array-bounds.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-03-02 14:47:41 +0100
committerAldy Hernandez <aldyh@redhat.com>2023-04-26 10:28:12 +0200
commite6910b622ad6dc2995155b24b22aaf2acc22c927 (patch)
treed1bf58b5f66a3be60ad6bc6764be858f56d3f6a3 /gcc/gimple-array-bounds.cc
parent3d8c2d3aefa85d1e5f15804dd6345a88d139f9fb (diff)
downloadgcc-e6910b622ad6dc2995155b24b22aaf2acc22c927.zip
gcc-e6910b622ad6dc2995155b24b22aaf2acc22c927.tar.gz
gcc-e6910b622ad6dc2995155b24b22aaf2acc22c927.tar.bz2
Remove range_query::get_value_range.
gcc/ChangeLog: * gimple-array-bounds.cc (array_bounds_checker::get_value_range): Add irange argument. (check_out_of_bounds_and_warn): Remove check for vr. (array_bounds_checker::check_array_ref): Remove pointer qualifier for vr and adjust accordingly. * gimple-array-bounds.h (get_value_range): Add irange argument. * value-query.cc (class equiv_allocator): Delete. (range_query::get_value_range): Delete. (range_query::range_query): Remove allocator access. (range_query::~range_query): Same. * value-query.h (get_value_range): Delete. * vr-values.cc (simplify_using_ranges::op_with_boolean_value_range_p): Remove call to get_value_range. (check_for_binary_op_overflow): Same. (simplify_using_ranges::legacy_fold_cond_overflow): Same. (simplify_using_ranges::simplify_abs_using_ranges): Same. (simplify_using_ranges::simplify_cond_using_ranges_1): Same. (simplify_using_ranges::simplify_casted_cond): Same. (simplify_using_ranges::simplify_switch_using_ranges): Same. (simplify_using_ranges::two_valued_val_range_p): Same.
Diffstat (limited to 'gcc/gimple-array-bounds.cc')
-rw-r--r--gcc/gimple-array-bounds.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc
index 34e039a..775f0c1 100644
--- a/gcc/gimple-array-bounds.cc
+++ b/gcc/gimple-array-bounds.cc
@@ -46,10 +46,12 @@ array_bounds_checker::array_bounds_checker (struct function *func,
/* No-op. */
}
-const value_range *
-array_bounds_checker::get_value_range (const_tree op, gimple *stmt)
+void
+array_bounds_checker::get_value_range (irange &r, const_tree op, gimple *stmt)
{
- return m_ptr_qry.rvals->get_value_range (op, stmt);
+ if (m_ptr_qry.rvals->range_of_expr (r, const_cast<tree> (op), stmt))
+ return;
+ r.set_varying (TREE_TYPE (op));
}
/* Try to determine the DECL that REF refers to. Return the DECL or
@@ -282,7 +284,7 @@ check_out_of_bounds_and_warn (location_t location, tree ref,
if (warned)
; /* Do nothing. */
- else if (vr && vr->kind () == VR_ANTI_RANGE)
+ else if (vr->kind () == VR_ANTI_RANGE)
{
if (up_bound
&& TREE_CODE (up_sub) == INTEGER_CST
@@ -370,20 +372,20 @@ array_bounds_checker::check_array_ref (location_t location, tree ref,
tree up_sub = low_sub_org;
tree low_sub = low_sub_org;
- const value_range *vr = NULL;
+ value_range vr;
if (TREE_CODE (low_sub_org) == SSA_NAME)
{
- vr = get_value_range (low_sub_org, stmt);
- if (!vr->undefined_p () && !vr->varying_p ())
+ get_value_range (vr, low_sub_org, stmt);
+ if (!vr.undefined_p () && !vr.varying_p ())
{
- low_sub = vr->kind () == VR_RANGE ? vr->max () : vr->min ();
- up_sub = vr->kind () == VR_RANGE ? vr->min () : vr->max ();
+ low_sub = vr.kind () == VR_RANGE ? vr.max () : vr.min ();
+ up_sub = vr.kind () == VR_RANGE ? vr.min () : vr.max ();
}
}
warned = check_out_of_bounds_and_warn (location, ref,
low_sub_org, low_sub, up_sub,
- up_bound, up_bound_p1, vr,
+ up_bound, up_bound_p1, &vr,
ignore_off_by_one, warn_array_bounds,
&out_of_bound);