aboutsummaryrefslogtreecommitdiff
path: root/gcc/vr-values.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/vr-values.c')
-rw-r--r--gcc/vr-values.c260
1 files changed, 124 insertions, 136 deletions
diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index d1713bf..b970339 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -54,7 +54,7 @@ along with GCC; see the file COPYING3. If not see
/* Set value range VR to a non-negative range of type TYPE. */
static inline void
-set_value_range_to_nonnegative (value_range *vr, tree type)
+set_value_range_to_nonnegative (value_range_equiv *vr, tree type)
{
tree zero = build_int_cst (type, 0);
vr->update (VR_RANGE, zero, vrp_val_max (type));
@@ -63,7 +63,7 @@ set_value_range_to_nonnegative (value_range *vr, tree type)
/* Set value range VR to a range of a truthvalue of type TYPE. */
static inline void
-set_value_range_to_truthvalue (value_range *vr, tree type)
+set_value_range_to_truthvalue (value_range_equiv *vr, tree type)
{
if (TYPE_PRECISION (type) == 1)
vr->set_varying (type);
@@ -74,10 +74,10 @@ set_value_range_to_truthvalue (value_range *vr, tree type)
/* Return the lattice entry for VAR or NULL if it doesn't exist or cannot
be initialized. */
-value_range *
+value_range_equiv *
vr_values::get_lattice_entry (const_tree var)
{
- value_range *vr;
+ value_range_equiv *vr;
tree sym;
unsigned ver = SSA_NAME_VERSION (var);
@@ -145,21 +145,21 @@ vr_values::get_lattice_entry (const_tree var)
If we have no values ranges recorded (ie, VRP is not running), then
return NULL. Otherwise create an empty range if none existed for VAR. */
-const value_range *
+const value_range_equiv *
vr_values::get_value_range (const_tree var)
{
/* If we have no recorded ranges, then return NULL. */
if (!vr_value)
return NULL;
- value_range *vr = get_lattice_entry (var);
+ value_range_equiv *vr = get_lattice_entry (var);
/* Reallocate the lattice if needed. */
if (!vr)
{
unsigned int old_sz = num_vr_values;
num_vr_values = num_ssa_names + num_ssa_names / 10;
- vr_value = XRESIZEVEC (value_range *, vr_value, num_vr_values);
+ vr_value = XRESIZEVEC (value_range_equiv *, vr_value, num_vr_values);
for ( ; old_sz < num_vr_values; old_sz++)
vr_value [old_sz] = NULL;
@@ -176,7 +176,7 @@ vr_values::get_value_range (const_tree var)
void
vr_values::set_def_to_varying (const_tree def)
{
- value_range *vr = get_lattice_entry (def);
+ value_range_equiv *vr = get_lattice_entry (def);
if (vr)
vr->set_varying (TREE_TYPE (def));
}
@@ -203,18 +203,18 @@ vr_values::set_defs_to_varying (gimple *stmt)
is the range object associated with another SSA name. */
bool
-vr_values::update_value_range (const_tree var, value_range *new_vr)
+vr_values::update_value_range (const_tree var, value_range_equiv *new_vr)
{
- value_range *old_vr;
+ value_range_equiv *old_vr;
bool is_new;
/* If there is a value-range on the SSA name from earlier analysis
factor that in. */
if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
{
- value_range nr;
- value_range_kind rtype = get_range_info (var, nr);
- if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE)
+ value_range_equiv nr;
+ get_range_info (var, nr);
+ if (!nr.undefined_p ())
new_vr->intersect (&nr);
}
@@ -258,7 +258,7 @@ vr_values::update_value_range (const_tree var, value_range *new_vr)
/* Return true if value range VR involves exactly one symbol SYM. */
static bool
-symbolic_range_based_on_p (value_range_base *vr, const_tree sym)
+symbolic_range_based_on_p (value_range *vr, const_tree sym)
{
bool neg, min_has_symbol, max_has_symbol;
tree inv;
@@ -377,7 +377,8 @@ vr_values::vrp_stmt_computes_nonzero (gimple *stmt)
|| (flag_delete_null_pointer_checks
&& !TYPE_OVERFLOW_WRAPS (TREE_TYPE (expr))))
{
- const value_range *vr = get_value_range (TREE_OPERAND (base, 0));
+ const value_range_equiv *vr
+ = get_value_range (TREE_OPERAND (base, 0));
if (!range_includes_zero_p (vr))
return true;
}
@@ -436,7 +437,7 @@ vr_values::op_with_constant_singleton_value_range (tree op)
bool
vr_values::op_with_boolean_value_range_p (tree op)
{
- const value_range *vr;
+ const value_range_equiv *vr;
if (TYPE_PRECISION (TREE_TYPE (op)) == 1)
return true;
@@ -461,10 +462,10 @@ void
vr_values::extract_range_for_var_from_comparison_expr (tree var,
enum tree_code cond_code,
tree op, tree limit,
- value_range *vr_p)
+ value_range_equiv *vr_p)
{
tree min, max, type;
- const value_range *limit_vr;
+ const value_range_equiv *limit_vr;
type = TREE_TYPE (var);
/* For pointer arithmetic, we only keep track of pointer equality
@@ -538,7 +539,7 @@ vr_values::extract_range_for_var_from_comparison_expr (tree var,
vice-versa. Use set_and_canonicalize which does this for
us. */
if (cond_code == LE_EXPR)
- vr_p->set (VR_RANGE, min, max, vr_p->equiv ());
+ vr_p->set (VR_RANGE, min, max, vr_p->equiv ());
else if (cond_code == GT_EXPR)
vr_p->set (VR_ANTI_RANGE, min, max, vr_p->equiv ());
else
@@ -705,7 +706,7 @@ vr_values::extract_range_for_var_from_comparison_expr (tree var,
it in *VR_P. */
void
-vr_values::extract_range_from_assert (value_range *vr_p, tree expr)
+vr_values::extract_range_from_assert (value_range_equiv *vr_p, tree expr)
{
tree var = ASSERT_EXPR_VAR (expr);
tree cond = ASSERT_EXPR_COND (expr);
@@ -751,9 +752,9 @@ vr_values::extract_range_from_assert (value_range *vr_p, tree expr)
always false. */
void
-vr_values::extract_range_from_ssa_name (value_range *vr, tree var)
+vr_values::extract_range_from_ssa_name (value_range_equiv *vr, tree var)
{
- const value_range *var_vr = get_value_range (var);
+ const value_range_equiv *var_vr = get_value_range (var);
if (!var_vr->varying_p ())
vr->deep_copy (var_vr);
@@ -769,13 +770,13 @@ vr_values::extract_range_from_ssa_name (value_range *vr, tree var)
The resulting range is stored in *VR. */
void
-vr_values::extract_range_from_binary_expr (value_range *vr,
+vr_values::extract_range_from_binary_expr (value_range_equiv *vr,
enum tree_code code,
tree expr_type, tree op0, tree op1)
{
/* Get value ranges for each operand. For constant operands, create
a new value range with the operand to simplify processing. */
- value_range_base vr0, vr1;
+ value_range vr0, vr1;
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
@@ -796,13 +797,9 @@ vr_values::extract_range_from_binary_expr (value_range *vr,
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (op0)))
{
if (vr0.varying_p () && !vr1.varying_p ())
- vr0 = value_range (VR_RANGE,
- vrp_val_min (expr_type),
- vrp_val_max (expr_type));
+ vr0 = value_range (vrp_val_min (expr_type), vrp_val_max (expr_type));
else if (vr1.varying_p () && !vr0.varying_p ())
- vr1 = value_range (VR_RANGE,
- vrp_val_min (expr_type),
- vrp_val_max (expr_type));
+ vr1 = value_range (vrp_val_min (expr_type), vrp_val_max (expr_type));
}
range_fold_binary_expr (vr, code, expr_type, &vr0, &vr1);
@@ -917,10 +914,11 @@ vr_values::extract_range_from_binary_expr (value_range *vr,
The resulting range is stored in *VR. */
void
-vr_values::extract_range_from_unary_expr (value_range *vr, enum tree_code code,
+vr_values::extract_range_from_unary_expr (value_range_equiv *vr,
+ enum tree_code code,
tree type, tree op0)
{
- value_range_base vr0;
+ value_range vr0;
/* Get value ranges for the operand. For constant operands, create
a new value range with the operand to simplify processing. */
@@ -939,13 +937,13 @@ vr_values::extract_range_from_unary_expr (value_range *vr, enum tree_code code,
the ranges of each of its operands and the expression code. */
void
-vr_values::extract_range_from_cond_expr (value_range *vr, gassign *stmt)
+vr_values::extract_range_from_cond_expr (value_range_equiv *vr, gassign *stmt)
{
/* Get value ranges for each operand. For constant operands, create
a new value range with the operand to simplify processing. */
tree op0 = gimple_assign_rhs2 (stmt);
- value_range tem0;
- const value_range *vr0 = &tem0;
+ value_range_equiv tem0;
+ const value_range_equiv *vr0 = &tem0;
if (TREE_CODE (op0) == SSA_NAME)
vr0 = get_value_range (op0);
else if (is_gimple_min_invariant (op0))
@@ -954,8 +952,8 @@ vr_values::extract_range_from_cond_expr (value_range *vr, gassign *stmt)
tem0.set_varying (TREE_TYPE (op0));
tree op1 = gimple_assign_rhs3 (stmt);
- value_range tem1;
- const value_range *vr1 = &tem1;
+ value_range_equiv tem1;
+ const value_range_equiv *vr1 = &tem1;
if (TREE_CODE (op1) == SSA_NAME)
vr1 = get_value_range (op1);
else if (is_gimple_min_invariant (op1))
@@ -973,7 +971,8 @@ vr_values::extract_range_from_cond_expr (value_range *vr, gassign *stmt)
on the range of its operand and the expression code. */
void
-vr_values::extract_range_from_comparison (value_range *vr, enum tree_code code,
+vr_values::extract_range_from_comparison (value_range_equiv *vr,
+ enum tree_code code,
tree type, tree op0, tree op1)
{
bool sop;
@@ -1007,7 +1006,7 @@ bool
vr_values::check_for_binary_op_overflow (enum tree_code subcode, tree type,
tree op0, tree op1, bool *ovf)
{
- value_range_base vr0, vr1;
+ value_range vr0, vr1;
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *get_value_range (op0);
else if (TREE_CODE (op0) == INTEGER_CST)
@@ -1110,7 +1109,7 @@ vr_values::check_for_binary_op_overflow (enum tree_code subcode, tree type,
Store the result in *VR */
void
-vr_values::extract_range_basic (value_range *vr, gimple *stmt)
+vr_values::extract_range_basic (value_range_equiv *vr, gimple *stmt)
{
bool sop;
tree type = gimple_expr_type (stmt);
@@ -1144,7 +1143,7 @@ vr_values::extract_range_basic (value_range *vr, gimple *stmt)
maxi = prec;
if (TREE_CODE (arg) == SSA_NAME)
{
- const value_range *vr0 = get_value_range (arg);
+ const value_range_equiv *vr0 = get_value_range (arg);
/* If arg is non-zero, then ffs or popcount are non-zero. */
if (range_includes_zero_p (vr0) == 0)
mini = 1;
@@ -1182,7 +1181,7 @@ vr_values::extract_range_basic (value_range *vr, gimple *stmt)
mini = -2;
if (TREE_CODE (arg) == SSA_NAME)
{
- const value_range *vr0 = get_value_range (arg);
+ const value_range_equiv *vr0 = get_value_range (arg);
/* From clz of VR_RANGE minimum we can compute
result maximum. */
if (vr0->kind () == VR_RANGE
@@ -1239,7 +1238,7 @@ vr_values::extract_range_basic (value_range *vr, gimple *stmt)
}
if (TREE_CODE (arg) == SSA_NAME)
{
- const value_range *vr0 = get_value_range (arg);
+ const value_range_equiv *vr0 = get_value_range (arg);
/* If arg is non-zero, then use [0, prec - 1]. */
if ((vr0->kind () == VR_RANGE
&& integer_nonzerop (vr0->min ()))
@@ -1420,7 +1419,7 @@ vr_values::extract_range_basic (value_range *vr, gimple *stmt)
}
else
{
- value_range vr0, vr1;
+ value_range_equiv vr0, vr1;
bool saved_flag_wrapv = flag_wrapv;
/* Pretend the arithmetics is wrapping. If there is
any overflow, IMAGPART_EXPR will be set. */
@@ -1454,7 +1453,7 @@ vr_values::extract_range_basic (value_range *vr, gimple *stmt)
in *VR. */
void
-vr_values::extract_range_from_assignment (value_range *vr, gassign *stmt)
+vr_values::extract_range_from_assignment (value_range_equiv *vr, gassign *stmt)
{
enum tree_code code = gimple_assign_rhs_code (stmt);
@@ -1503,8 +1502,8 @@ vr_values::extract_range_from_assignment (value_range *vr, gassign *stmt)
static tree
-compare_ranges (enum tree_code comp, const value_range *vr0,
- const value_range *vr1, bool *strict_overflow_p)
+compare_ranges (enum tree_code comp, const value_range_equiv *vr0,
+ const value_range_equiv *vr1, bool *strict_overflow_p)
{
/* VARYING or UNDEFINED ranges cannot be compared. */
if (vr0->varying_p ()
@@ -1638,8 +1637,8 @@ compare_ranges (enum tree_code comp, const value_range *vr0,
assumed signed overflow is undefined. */
static tree
-compare_range_with_value (enum tree_code comp, const value_range *vr, tree val,
- bool *strict_overflow_p)
+compare_range_with_value (enum tree_code comp, const value_range_equiv *vr,
+ tree val, bool *strict_overflow_p)
{
if (vr->varying_p () || vr->undefined_p ())
return NULL_TREE;
@@ -1742,7 +1741,7 @@ compare_range_with_value (enum tree_code comp, const value_range *vr, tree val,
for VAR. If so, update VR with the new limits. */
void
-vr_values::adjust_range_with_scev (value_range *vr, class loop *loop,
+vr_values::adjust_range_with_scev (value_range_equiv *vr, class loop *loop,
gimple *stmt, tree var)
{
tree init, step, chrec, tmin, tmax, min, max, type, tem;
@@ -1815,7 +1814,6 @@ vr_values::adjust_range_with_scev (value_range *vr, class loop *loop,
the number of latch executions is the correct thing to use. */
if (max_loop_iterations (loop, &nit))
{
- value_range maxvr;
signop sgn = TYPE_SIGN (TREE_TYPE (step));
wi::overflow_type overflow;
@@ -1831,13 +1829,14 @@ vr_values::adjust_range_with_scev (value_range *vr, class loop *loop,
&& (sgn == UNSIGNED
|| wi::gts_p (wtmp, 0) == wi::gts_p (wi::to_wide (step), 0)))
{
+ value_range_equiv maxvr;
tem = wide_int_to_tree (TREE_TYPE (init), wtmp);
extract_range_from_binary_expr (&maxvr, PLUS_EXPR,
TREE_TYPE (init), init, tem);
/* Likewise if the addition did. */
if (maxvr.kind () == VR_RANGE)
{
- value_range_base initvr;
+ value_range initvr;
if (TREE_CODE (init) == SSA_NAME)
initvr = *(get_value_range (init));
@@ -1952,7 +1951,7 @@ vr_values::vr_values () : vrp_value_range_pool ("Tree VRP value ranges")
{
values_propagated = false;
num_vr_values = num_ssa_names * 2;
- vr_value = XCNEWVEC (value_range *, num_vr_values);
+ vr_value = XCNEWVEC (value_range_equiv *, num_vr_values);
vr_phi_edge_counts = XCNEWVEC (int, num_ssa_names);
bitmap_obstack_initialize (&vrp_equiv_obstack);
to_remove_edges = vNULL;
@@ -1992,7 +1991,7 @@ vrp_valueize (tree name)
{
if (TREE_CODE (name) == SSA_NAME)
{
- const value_range *vr = x_vr_values->get_value_range (name);
+ const value_range_equiv *vr = x_vr_values->get_value_range (name);
if (vr->kind () == VR_RANGE
&& (TREE_CODE (vr->min ()) == SSA_NAME
|| is_gimple_min_invariant (vr->min ()))
@@ -2017,7 +2016,7 @@ vrp_valueize_1 (tree name)
if (!gimple_nop_p (def_stmt)
&& prop_simulate_again_p (def_stmt))
return NULL_TREE;
- const value_range *vr = x_vr_values->get_value_range (name);
+ const value_range_equiv *vr = x_vr_values->get_value_range (name);
tree singleton;
if (vr->singleton_p (&singleton))
return singleton;
@@ -2053,7 +2052,7 @@ get_output_for_vrp (gimple *stmt)
void
vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p,
- value_range *vr)
+ value_range_equiv *vr)
{
tree lhs = get_output_for_vrp (stmt);
*output_p = lhs;
@@ -2095,11 +2094,11 @@ vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p,
or a symbolic range containing the SSA_NAME only if the value range
is varying or undefined. Uses TEM as storage for the alternate range. */
-const value_range *
-vr_values::get_vr_for_comparison (int i, value_range *tem)
+const value_range_equiv *
+vr_values::get_vr_for_comparison (int i, value_range_equiv *tem)
{
/* Shallow-copy equiv bitmap. */
- const value_range *vr = get_value_range (ssa_name (i));
+ const value_range_equiv *vr = get_value_range (ssa_name (i));
/* If name N_i does not have a valid range, use N_i as its own
range. This allows us to compare against names that may
@@ -2122,52 +2121,46 @@ tree
vr_values::compare_name_with_value (enum tree_code comp, tree var, tree val,
bool *strict_overflow_p, bool use_equiv_p)
{
- bitmap_iterator bi;
- unsigned i;
- bitmap e;
- tree retval, t;
- int used_strict_overflow;
- bool sop;
- const value_range *equiv_vr;
- value_range tem_vr;
-
/* Get the set of equivalences for VAR. */
- e = get_value_range (var)->equiv ();
+ bitmap e = get_value_range (var)->equiv ();
/* Start at -1. Set it to 0 if we do a comparison without relying
on overflow, or 1 if all comparisons rely on overflow. */
- used_strict_overflow = -1;
+ int used_strict_overflow = -1;
/* Compare vars' value range with val. */
- equiv_vr = get_vr_for_comparison (SSA_NAME_VERSION (var), &tem_vr);
- sop = false;
- retval = compare_range_with_value (comp, equiv_vr, val, &sop);
+ value_range_equiv tem_vr;
+ const value_range_equiv *equiv_vr
+ = get_vr_for_comparison (SSA_NAME_VERSION (var), &tem_vr);
+ bool sop = false;
+ tree retval = compare_range_with_value (comp, equiv_vr, val, &sop);
if (retval)
used_strict_overflow = sop ? 1 : 0;
/* If the equiv set is empty we have done all work we need to do. */
if (e == NULL)
{
- if (retval
- && used_strict_overflow > 0)
+ if (retval && used_strict_overflow > 0)
*strict_overflow_p = true;
return retval;
}
+ unsigned i;
+ bitmap_iterator bi;
EXECUTE_IF_SET_IN_BITMAP (e, 0, i, bi)
{
tree name = ssa_name (i);
- if (! name)
+ if (!name)
continue;
- if (! use_equiv_p
- && ! SSA_NAME_IS_DEFAULT_DEF (name)
+ if (!use_equiv_p
+ && !SSA_NAME_IS_DEFAULT_DEF (name)
&& prop_simulate_again_p (SSA_NAME_DEF_STMT (name)))
continue;
equiv_vr = get_vr_for_comparison (i, &tem_vr);
sop = false;
- t = compare_range_with_value (comp, equiv_vr, val, &sop);
+ tree t = compare_range_with_value (comp, equiv_vr, val, &sop);
if (t)
{
/* If we get different answers from different members
@@ -2189,8 +2182,7 @@ vr_values::compare_name_with_value (enum tree_code comp, tree var, tree val,
}
}
- if (retval
- && used_strict_overflow > 0)
+ if (retval && used_strict_overflow > 0)
*strict_overflow_p = true;
return retval;
@@ -2208,20 +2200,14 @@ tree
vr_values::compare_names (enum tree_code comp, tree n1, tree n2,
bool *strict_overflow_p)
{
- tree t, retval;
- bitmap e1, e2;
- bitmap_iterator bi1, bi2;
- unsigned i1, i2;
- int used_strict_overflow;
- static bitmap_obstack *s_obstack = NULL;
- static bitmap s_e1 = NULL, s_e2 = NULL;
-
/* Compare the ranges of every name equivalent to N1 against the
ranges of every name equivalent to N2. */
- e1 = get_value_range (n1)->equiv ();
- e2 = get_value_range (n2)->equiv ();
+ bitmap e1 = get_value_range (n1)->equiv ();
+ bitmap e2 = get_value_range (n2)->equiv ();
/* Use the fake bitmaps if e1 or e2 are not available. */
+ static bitmap s_e1 = NULL, s_e2 = NULL;
+ static bitmap_obstack *s_obstack = NULL;
if (s_obstack == NULL)
{
s_obstack = XNEW (bitmap_obstack);
@@ -2254,29 +2240,33 @@ vr_values::compare_names (enum tree_code comp, tree n1, tree n2,
/* Start at -1. Set it to 0 if we do a comparison without relying
on overflow, or 1 if all comparisons rely on overflow. */
- used_strict_overflow = -1;
+ int used_strict_overflow = -1;
/* Otherwise, compare all the equivalent ranges. First, add N1 and
N2 to their own set of equivalences to avoid duplicating the body
of the loop just to check N1 and N2 ranges. */
+ bitmap_iterator bi1;
+ unsigned i1;
EXECUTE_IF_SET_IN_BITMAP (e1, 0, i1, bi1)
{
- if (! ssa_name (i1))
+ if (!ssa_name (i1))
continue;
- value_range tem_vr1;
- const value_range *vr1 = get_vr_for_comparison (i1, &tem_vr1);
+ value_range_equiv tem_vr1;
+ const value_range_equiv *vr1 = get_vr_for_comparison (i1, &tem_vr1);
- t = retval = NULL_TREE;
+ tree t = NULL_TREE, retval = NULL_TREE;
+ bitmap_iterator bi2;
+ unsigned i2;
EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2)
{
- if (! ssa_name (i2))
+ if (!ssa_name (i2))
continue;
bool sop = false;
- value_range tem_vr2;
- const value_range *vr2 = get_vr_for_comparison (i2, &tem_vr2);
+ value_range_equiv tem_vr2;
+ const value_range_equiv *vr2 = get_vr_for_comparison (i2, &tem_vr2);
t = compare_ranges (comp, vr1, vr2, &sop);
if (t)
@@ -2285,8 +2275,7 @@ vr_values::compare_names (enum tree_code comp, tree n1, tree n2,
of the equivalence set this check must be in a dead
code region. Folding it to a trap representation
would be correct here. For now just return don't-know. */
- if (retval != NULL
- && t != retval)
+ if (retval != NULL && t != retval)
{
bitmap_clear_bit (e1, SSA_NAME_VERSION (n1));
bitmap_clear_bit (e2, SSA_NAME_VERSION (n2));
@@ -2325,8 +2314,7 @@ tree
vr_values::vrp_evaluate_conditional_warnv_with_ops_using_ranges
(enum tree_code code, tree op0, tree op1, bool * strict_overflow_p)
{
- const value_range *vr0, *vr1;
-
+ const value_range_equiv *vr0, *vr1;
vr0 = (TREE_CODE (op0) == SSA_NAME) ? get_value_range (op0) : NULL;
vr1 = (TREE_CODE (op1) == SSA_NAME) ? get_value_range (op1) : NULL;
@@ -2392,7 +2380,7 @@ vr_values::vrp_evaluate_conditional_warnv_with_ops (enum tree_code code,
}
else
{
- value_range_base vro, vri;
+ value_range vro, vri;
if (code == GT_EXPR || code == GE_EXPR)
{
vro.set (VR_ANTI_RANGE, TYPE_MIN_VALUE (TREE_TYPE (op0)), x);
@@ -2405,7 +2393,7 @@ vr_values::vrp_evaluate_conditional_warnv_with_ops (enum tree_code code,
}
else
gcc_unreachable ();
- const value_range *vr0 = get_value_range (op0);
+ const value_range_equiv *vr0 = get_value_range (op0);
/* If vro, the range for OP0 to pass the overflow test, has
no intersection with *vr0, OP0's known range, then the
overflow test can't pass, so return the node for false.
@@ -2511,7 +2499,7 @@ vr_values::vrp_evaluate_conditional (tree_code code, tree op0,
always fold regardless of the value of OP0. If -Wtype-limits
was specified, emit a warning. */
tree type = TREE_TYPE (op0);
- const value_range *vr0 = get_value_range (op0);
+ const value_range_equiv *vr0 = get_value_range (op0);
if (vr0->kind () == VR_RANGE
&& INTEGRAL_TYPE_P (type)
@@ -2637,9 +2625,9 @@ vr_values::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p)
Returns true if the default label is not needed. */
static bool
-find_case_label_ranges (gswitch *stmt, const value_range *vr, size_t *min_idx1,
- size_t *max_idx1, size_t *min_idx2,
- size_t *max_idx2)
+find_case_label_ranges (gswitch *stmt, const value_range_equiv *vr,
+ size_t *min_idx1, size_t *max_idx1,
+ size_t *min_idx2, size_t *max_idx2)
{
size_t i, j, k, l;
unsigned int n = gimple_switch_num_labels (stmt);
@@ -2717,7 +2705,7 @@ void
vr_values::vrp_visit_switch_stmt (gswitch *stmt, edge *taken_edge_p)
{
tree op, val;
- const value_range *vr;
+ const value_range_equiv *vr;
size_t i = 0, j = 0, k, l;
bool take_default;
@@ -2807,7 +2795,7 @@ vr_values::vrp_visit_switch_stmt (gswitch *stmt, edge *taken_edge_p)
void
vr_values::extract_range_from_stmt (gimple *stmt, edge *taken_edge_p,
- tree *output_p, value_range *vr)
+ tree *output_p, value_range_equiv *vr)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2831,13 +2819,13 @@ vr_values::extract_range_from_stmt (gimple *stmt, edge *taken_edge_p,
value ranges, set a new range in VR_RESULT. */
void
-vr_values::extract_range_from_phi_node (gphi *phi, value_range *vr_result)
+vr_values::extract_range_from_phi_node (gphi *phi,
+ value_range_equiv *vr_result)
{
- size_t i;
tree lhs = PHI_RESULT (phi);
- const value_range *lhs_vr = get_value_range (lhs);
+ const value_range_equiv *lhs_vr = get_value_range (lhs);
bool first = true;
- int edges, old_edges;
+ int old_edges;
class loop *l;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2847,8 +2835,8 @@ vr_values::extract_range_from_phi_node (gphi *phi, value_range *vr_result)
}
bool may_simulate_backedge_again = false;
- edges = 0;
- for (i = 0; i < gimple_phi_num_args (phi); i++)
+ int edges = 0;
+ for (size_t i = 0; i < gimple_phi_num_args (phi); i++)
{
edge e = gimple_phi_arg_edge (phi, i);
@@ -2862,12 +2850,12 @@ vr_values::extract_range_from_phi_node (gphi *phi, value_range *vr_result)
if (e->flags & EDGE_EXECUTABLE)
{
- tree arg = PHI_ARG_DEF (phi, i);
- value_range vr_arg_tem;
- const value_range *vr_arg = &vr_arg_tem;
+ value_range_equiv vr_arg_tem;
+ const value_range_equiv *vr_arg = &vr_arg_tem;
++edges;
+ tree arg = PHI_ARG_DEF (phi, i);
if (TREE_CODE (arg) == SSA_NAME)
{
/* See if we are eventually going to change one of the args. */
@@ -2877,7 +2865,7 @@ vr_values::extract_range_from_phi_node (gphi *phi, value_range *vr_result)
&& e->flags & EDGE_DFS_BACK)
may_simulate_backedge_again = true;
- const value_range *vr_arg_ = get_value_range (arg);
+ const value_range_equiv *vr_arg_ = get_value_range (arg);
/* Do not allow equivalences or symbolic ranges to leak in from
backedges. That creates invalid equivalencies.
See PR53465 and PR54767. */
@@ -3128,7 +3116,7 @@ vr_values::simplify_div_or_mod_using_ranges (gimple_stmt_iterator *gsi,
tree op1 = gimple_assign_rhs2 (stmt);
tree op0min = NULL_TREE, op0max = NULL_TREE;
tree op1min = op1;
- const value_range *vr = NULL;
+ const value_range_equiv *vr = NULL;
if (TREE_CODE (op0) == INTEGER_CST)
{
@@ -3148,7 +3136,7 @@ vr_values::simplify_div_or_mod_using_ranges (gimple_stmt_iterator *gsi,
if (rhs_code == TRUNC_MOD_EXPR
&& TREE_CODE (op1) == SSA_NAME)
{
- const value_range *vr1 = get_value_range (op1);
+ const value_range_equiv *vr1 = get_value_range (op1);
if (range_int_cst_p (vr1))
op1min = vr1->min ();
}
@@ -3295,7 +3283,7 @@ bool
vr_values::simplify_abs_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
{
tree op = gimple_assign_rhs1 (stmt);
- const value_range *vr = get_value_range (op);
+ const value_range_equiv *vr = get_value_range (op);
if (vr)
{
@@ -3348,7 +3336,7 @@ vr_values::simplify_abs_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
static bool
vr_set_zero_nonzero_bits (const tree expr_type,
- const value_range_base *vr,
+ const value_range *vr,
wide_int *may_be_nonzero,
wide_int *must_be_nonzero)
{
@@ -3378,7 +3366,7 @@ vr_values::simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi,
tree op0 = gimple_assign_rhs1 (stmt);
tree op1 = gimple_assign_rhs2 (stmt);
tree op = NULL_TREE;
- value_range_base vr0, vr1;
+ value_range vr0, vr1;
wide_int may_be_nonzero0, may_be_nonzero1;
wide_int must_be_nonzero0, must_be_nonzero1;
wide_int mask;
@@ -3457,7 +3445,7 @@ vr_values::simplify_bit_ops_using_ranges (gimple_stmt_iterator *gsi,
static tree
test_for_singularity (enum tree_code cond_code, tree op0,
- tree op1, const value_range *vr)
+ tree op1, const value_range_equiv *vr)
{
tree min = NULL;
tree max = NULL;
@@ -3515,7 +3503,7 @@ test_for_singularity (enum tree_code cond_code, tree op0,
by PRECISION and UNSIGNED_P. */
static bool
-range_fits_type_p (const value_range *vr,
+range_fits_type_p (const value_range_equiv *vr,
unsigned dest_precision, signop dest_sgn)
{
tree src_type;
@@ -3580,7 +3568,7 @@ vr_values::simplify_cond_using_ranges_1 (gcond *stmt)
&& INTEGRAL_TYPE_P (TREE_TYPE (op0))
&& is_gimple_min_invariant (op1))
{
- const value_range *vr = get_value_range (op0);
+ const value_range_equiv *vr = get_value_range (op0);
/* If we have range information for OP0, then we might be
able to simplify this conditional. */
@@ -3683,7 +3671,7 @@ vr_values::simplify_cond_using_ranges_2 (gcond *stmt)
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (innerop)
&& desired_pro_or_demotion_p (TREE_TYPE (innerop), TREE_TYPE (op0)))
{
- const value_range *vr = get_value_range (innerop);
+ const value_range_equiv *vr = get_value_range (innerop);
if (range_int_cst_p (vr)
&& range_fits_type_p (vr,
@@ -3713,7 +3701,7 @@ bool
vr_values::simplify_switch_using_ranges (gswitch *stmt)
{
tree op = gimple_switch_index (stmt);
- const value_range *vr = NULL;
+ const value_range_equiv *vr = NULL;
bool take_default;
edge e;
edge_iterator ei;
@@ -4013,7 +4001,7 @@ vr_values::simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi,
gimple *stmt)
{
tree rhs1 = gimple_assign_rhs1 (stmt);
- const value_range *vr = get_value_range (rhs1);
+ const value_range_equiv *vr = get_value_range (rhs1);
scalar_float_mode fltmode
= SCALAR_FLOAT_TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt)));
scalar_int_mode mode;
@@ -4176,7 +4164,7 @@ vr_values::simplify_internal_call_using_ranges (gimple_stmt_iterator *gsi,
bool
vr_values::two_valued_val_range_p (tree var, tree *a, tree *b)
{
- const value_range *vr = get_value_range (var);
+ const value_range_equiv *vr = get_value_range (var);
if (vr->varying_p ()
|| vr->undefined_p ()
|| TREE_CODE (vr->min ()) != INTEGER_CST
@@ -4355,7 +4343,7 @@ vr_values::simplify_stmt_using_ranges (gimple_stmt_iterator *gsi)
/* Set the lattice entry for VAR to VR. */
void
-vr_values::set_vr_value (tree var, value_range *vr)
+vr_values::set_vr_value (tree var, value_range_equiv *vr)
{
if (SSA_NAME_VERSION (var) >= num_vr_values)
return;
@@ -4364,8 +4352,8 @@ vr_values::set_vr_value (tree var, value_range *vr)
/* Swap the lattice entry for VAR with VR and return the old entry. */
-value_range *
-vr_values::swap_vr_value (tree var, value_range *vr)
+value_range_equiv *
+vr_values::swap_vr_value (tree var, value_range_equiv *vr)
{
if (SSA_NAME_VERSION (var) >= num_vr_values)
return NULL;