@@ -223,7 +223,8 @@ refine_value_range_using_guard (tree type, tree var,
else if (TREE_CODE (varc1) == SSA_NAME
&& INTEGRAL_TYPE_P (type)
&& get_range_query (cfun)->range_of_expr (r, varc1)
- && r.kind () == VR_RANGE)
+ && !r.undefined_p ()
+ && !r.varying_p ())
{
gcc_assert (wi::le_p (r.lower_bound (), r.upper_bound (), sgn));
wi::to_mpz (r.lower_bound (), minc1, sgn);
@@ -368,7 +369,10 @@ determine_value_range (class loop *loop, tree type, tree var, mpz_t off,
/* Either for VAR itself... */
Value_Range var_range (TREE_TYPE (var));
get_range_query (cfun)->range_of_expr (var_range, var);
- rtype = var_range.kind ();
+ if (var_range.varying_p () || var_range.undefined_p ())
+ rtype = VR_VARYING;
+ else
+ rtype = VR_RANGE;
if (!var_range.undefined_p ())
{
minv = var_range.lower_bound ();
@@ -384,7 +388,8 @@ determine_value_range (class loop *loop, tree type, tree var, mpz_t off,
if (PHI_ARG_DEF_FROM_EDGE (phi, e) == var
&& get_range_query (cfun)->range_of_expr (phi_range,
gimple_phi_result (phi))
- && phi_range.kind () == VR_RANGE)
+ && !phi_range.varying_p ()
+ && !phi_range.undefined_p ())
{
if (rtype != VR_RANGE)
{
@@ -404,7 +409,10 @@ determine_value_range (class loop *loop, tree type, tree var, mpz_t off,
{
Value_Range vr (TREE_TYPE (var));
get_range_query (cfun)->range_of_expr (vr, var);
- rtype = vr.kind ();
+ if (vr.varying_p () || vr.undefined_p ())
+ rtype = VR_VARYING;
+ else
+ rtype = VR_RANGE;
if (!vr.undefined_p ())
{
minv = vr.lower_bound ();
@@ -4045,7 +4053,8 @@ record_nonwrapping_iv (class loop *loop, tree base, tree step, gimple *stmt,
if (TREE_CODE (orig_base) == SSA_NAME
&& TREE_CODE (high) == INTEGER_CST
&& INTEGRAL_TYPE_P (TREE_TYPE (orig_base))
- && (base_range.kind () == VR_RANGE
+ && ((!base_range.varying_p ()
+ && !base_range.undefined_p ())
|| get_cst_init_from_scev (orig_base, &max, false))
&& wi::gts_p (wi::to_wide (high), max))
base = wide_int_to_tree (unsigned_type, max);
@@ -4067,7 +4076,8 @@ record_nonwrapping_iv (class loop *loop, tree base, tree step, gimple *stmt,
if (TREE_CODE (orig_base) == SSA_NAME
&& TREE_CODE (low) == INTEGER_CST
&& INTEGRAL_TYPE_P (TREE_TYPE (orig_base))
- && (base_range.kind () == VR_RANGE
+ && ((!base_range.varying_p ()
+ && !base_range.undefined_p ())
|| get_cst_init_from_scev (orig_base, &min, true))
&& wi::gts_p (min, wi::to_wide (low)))
base = wide_int_to_tree (unsigned_type, min);
@@ -4335,7 +4345,7 @@ infer_loop_bounds_from_signedness (class loop *loop, gimple *stmt)
high = upper_bound_in_type (type, type);
Value_Range r (TREE_TYPE (def));
get_range_query (cfun)->range_of_expr (r, def);
- if (r.kind () == VR_RANGE)
+ if (!r.varying_p () && !r.undefined_p ())
{
low = wide_int_to_tree (type, r.lower_bound ());
high = wide_int_to_tree (type, r.upper_bound ());
@@ -5385,7 +5395,7 @@ scev_var_range_cant_overflow (tree var, tree step, class loop *loop)
Value_Range r (TREE_TYPE (var));
get_range_query (cfun)->range_of_expr (r, var);
- if (r.kind () != VR_RANGE)
+ if (r.varying_p () || r.undefined_p ())
return false;
/* VAR is a scev whose evolution part is STEP and value range info
@@ -367,30 +367,6 @@ get_single_symbol (tree t, bool *neg, tree *inv)
return t;
}
-/* Return
- 1 if VAL < VAL2
- 0 if !(VAL < VAL2)
- -2 if those are incomparable. */
-int
-operand_less_p (tree val, tree val2)
-{
- /* LT is folded faster than GE and others. Inline the common case. */
- if (TREE_CODE (val) == INTEGER_CST && TREE_CODE (val2) == INTEGER_CST)
- return tree_int_cst_lt (val, val2);
- else if (TREE_CODE (val) == SSA_NAME && TREE_CODE (val2) == SSA_NAME)
- return val == val2 ? 0 : -2;
- else
- {
- int cmp = compare_values (val, val2);
- if (cmp == -1)
- return 1;
- else if (cmp == 0 || cmp == 1)
- return 0;
- else
- return -2;
- }
-}
-
/* Compare two values VAL1 and VAL2. Return
-2 if VAL1 and VAL2 cannot be compared at compile-time,
@@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see
extern int compare_values (tree, tree);
extern int compare_values_warnv (tree, tree, bool *);
-extern int operand_less_p (tree, tree);
extern enum value_range_kind intersect_range_with_nonzero_bits
(enum value_range_kind, wide_int *, wide_int *, const wide_int &, signop);
@@ -907,15 +907,10 @@ irange::operator= (const irange &src)
value_range_kind
get_legacy_range (const irange &r, tree &min, tree &max)
{
- value_range_kind old_kind = r.kind ();
- tree old_min = r.min ();
- tree old_max = r.max ();
-
if (r.undefined_p ())
{
min = NULL_TREE;
max = NULL_TREE;
- gcc_checking_assert (old_kind == VR_UNDEFINED);
return VR_UNDEFINED;
}
@@ -924,9 +919,6 @@ get_legacy_range (const irange &r, tree &min, tree &max)
{
min = wide_int_to_tree (type, r.lower_bound ());
max = wide_int_to_tree (type, r.upper_bound ());
- gcc_checking_assert (old_kind == VR_VARYING);
- gcc_checking_assert (vrp_operand_equal_p (old_min, min));
- gcc_checking_assert (vrp_operand_equal_p (old_max, max));
return VR_VARYING;
}
@@ -946,9 +938,6 @@ get_legacy_range (const irange &r, tree &min, tree &max)
min = wide_int_to_tree (type, r.lower_bound ());
max = wide_int_to_tree (type, r.upper_bound ());
- gcc_checking_assert (old_kind == VR_RANGE);
- gcc_checking_assert (vrp_operand_equal_p (old_min, min));
- gcc_checking_assert (vrp_operand_equal_p (old_max, max));
return VR_RANGE;
}
@@ -1165,44 +1154,6 @@ irange::singleton_p (tree *result) const
return false;
}
-/* Return 1 if VAL is inside value range.
- 0 if VAL is not inside value range.
- -2 if we cannot tell either way.
-
- Benchmark compile/20001226-1.c compilation time after changing this
- function. */
-
-int
-irange::value_inside_range (tree val) const
-{
- if (varying_p ())
- return 1;
-
- if (undefined_p ())
- return 0;
-
- gcc_checking_assert (TREE_CODE (val) == INTEGER_CST);
-
- // FIXME:
- if (TREE_CODE (val) == INTEGER_CST)
- return contains_p (val);
-
- int cmp1 = operand_less_p (val, min ());
- if (cmp1 == -2)
- return -2;
- if (cmp1 == 1)
- return m_kind != VR_RANGE;
-
- int cmp2 = operand_less_p (max (), val);
- if (cmp2 == -2)
- return -2;
-
- if (m_kind == VR_RANGE)
- return !cmp2;
- else
- return !!cmp2;
-}
-
/* Return TRUE if range contains INTEGER_CST. */
/* Return 1 if VAL is inside value range.
0 if VAL is not inside value range.
@@ -166,10 +166,6 @@ public:
wide_int get_nonzero_bits () const;
void set_nonzero_bits (const wide_int_ref &bits);
- // Deprecated legacy public methods.
- tree min () const; // DEPRECATED
- tree max () const; // DEPRECATED
-
protected:
irange (tree *, unsigned);
// potential promotion to public?
@@ -188,7 +184,6 @@ protected:
void normalize_kind ();
void verify_range ();
- int value_inside_range (tree) const;
private:
friend void gt_ggc_mx (irange *);
@@ -499,7 +494,6 @@ public:
void set (tree min, tree max, value_range_kind kind = VR_RANGE)
{ return m_vrange->set (min, max, kind); }
tree type () { return m_vrange->type (); }
- enum value_range_kind kind () { return m_vrange->kind (); }
bool varying_p () const { return m_vrange->varying_p (); }
bool undefined_p () const { return m_vrange->undefined_p (); }
void set_varying (tree type) { m_vrange->set_varying (type); }
@@ -645,26 +639,12 @@ 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);
-inline value_range_kind
-vrange::kind () const
-{
- return m_kind;
-}
-
// Number of sub-ranges in a range.
inline unsigned
irange::num_pairs () const
{
- if (m_kind == VR_ANTI_RANGE)
- {
- bool constant_p = (TREE_CODE (min ()) == INTEGER_CST
- && TREE_CODE (max ()) == INTEGER_CST);
- gcc_checking_assert (constant_p);
- return 2;
- }
- else
- return m_num_ranges;
+ return m_num_ranges;
}
inline tree
@@ -701,21 +681,6 @@ irange::tree_upper_bound () const
return tree_upper_bound (m_num_ranges - 1);
}
-inline tree
-irange::min () const
-{
- return tree_lower_bound (0);
-}
-
-inline tree
-irange::max () const
-{
- if (m_num_ranges)
- return tree_upper_bound ();
- else
- return NULL;
-}
-
inline bool
irange::varying_compatible_p () const
{