@@ -5297,7 +5297,7 @@ range_op_bitwise_and_tests ()
i1.set_nonzero (integer_type_node);
i2.set_varying (integer_type_node);
op_bitwise_or.fold_range (res, integer_type_node, i1, i2);
- ASSERT_TRUE (res.nonzero_p ());
+ ASSERT_FALSE (res.contains_zero_p ());
// (NEGATIVE | X) is nonzero.
i1 = int_range<1> (integer_type_node, INT (-5), INT (-3));
@@ -291,12 +291,6 @@ unsupported_range::zero_p () const
return false;
}
-bool
-unsupported_range::nonzero_p () const
-{
- return false;
-}
-
bool
unsupported_range::contains_zero_p () const
{
@@ -1697,31 +1691,6 @@ frange::set_nonzero (tree type)
set (type, dconstm0, dconst0, VR_ANTI_RANGE);
}
-// Return TRUE when this range is exactly the "everything but zero" set that
-// set_nonzero builds, mirroring irange::nonzero_p. Callers wanting "does not
-// contain zero" should use the !contains_p (0) idiom.
-//
-// A NAN is not a zero, so nonzero-ness depends only on the intervals, not on
-// whether the range may also be a NAN. We therefore recognize the nonzero
-// range by comparing intervals against set_nonzero's with the NAN state
-// ignored. A strict *this == set_nonzero () would be wrong: set_nonzero
-// leaves the NAN able to be either sign, so a range that is otherwise exactly
-// nonzero but whose NAN has been cleared would compare unequal.
-
-bool
-frange::nonzero_p () const
-{
- if (undefined_p () || known_isnan ())
- return false;
-
- frange nz;
- nz.set_nonzero (type ());
- nz.clear_nan ();
- frange tmp = *this;
- tmp.clear_nan ();
- return tmp == nz;
-}
-
// Return TRUE if the range contains zero (+0.0 or -0.0).
bool
@@ -3600,10 +3569,10 @@ range_tests_misc ()
r0 = range_int (0, 0);
ASSERT_TRUE (r0.zero_p ());
- // Test nonzero_p().
+ // Test contains_zero_p().
r0 = range_int (0, 0);
r0.invert ();
- ASSERT_TRUE (r0.nonzero_p ());
+ ASSERT_FALSE (r0.contains_zero_p ());
// r0 = ~[1,1]
r0 = range_int (1, 1, VR_ANTI_RANGE);
@@ -3861,26 +3830,25 @@ range_tests_sub_ranges_zero ()
// Excluding zero from [-0.0, 5.0] eats the lower end entirely.
r0.set_nonzero (float_type_node);
- ASSERT_TRUE (r0.nonzero_p ());
+ ASSERT_FALSE (r0.contains_zero_p ());
ASSERT_FALSE (r0.contains_p (dconst0));
ASSERT_FALSE (r0.contains_p (dconstm0));
- // A NAN is not a zero, so clearing the NAN leaves a nonzero range nonzero.
+ // A NAN is not a zero, so clearing the NAN leaves the range nonzero.
r0.clear_nan ();
- ASSERT_TRUE (r0.nonzero_p ());
+ ASSERT_FALSE (r0.contains_zero_p ());
- // A range that merely avoids zero is not the nonzero range.
+ // A range that avoids zero does not contain zero.
r0 = frange_float ("1.0", "10.0");
- ASSERT_FALSE (r0.nonzero_p ());
+ ASSERT_FALSE (r0.contains_zero_p ());
- // Excluding zero from [-0.0, 5.0] leaves (0, 5]: it avoids zero but is not
- // the whole nonzero range.
+ // Excluding zero from [-0.0, 5.0] leaves (0, 5], which does not contain zero.
r0 = frange_float ("-0.0", "5.0");
r0.clear_nan ();
r1 = frange_float_excluding ("0.0");
r0.intersect (r1);
ASSERT_EQ (r0.num_pairs (), 1);
- ASSERT_FALSE (r0.nonzero_p ());
+ ASSERT_FALSE (r0.contains_zero_p ());
ASSERT_FALSE (r0.contains_p (dconst0));
ASSERT_FALSE (r0.contains_p (dconstm0));
ASSERT_TRUE (r0.contains_p (real_from_str ("5.0")));
@@ -102,7 +102,6 @@ public:
virtual bool singleton_p (tree *result = NULL) const = 0;
virtual bool contains_p (tree cst) const = 0;
virtual bool zero_p () const = 0;
- virtual bool nonzero_p () const = 0;
virtual bool contains_zero_p () const = 0;
virtual void set_nonzero (tree type) = 0;
virtual void set_zero (tree type) = 0;
@@ -315,7 +314,6 @@ public:
// Predicates.
virtual bool zero_p () const override;
- virtual bool nonzero_p () const override;
virtual bool contains_zero_p () const override;
virtual bool singleton_p (tree *result = NULL) const override;
bool singleton_p (wide_int &) const;
@@ -423,7 +421,6 @@ public:
virtual bool fits_p (const vrange &v) const final override;
virtual bool singleton_p (tree *result = NULL) const final override;
virtual bool zero_p () const final override;
- virtual bool nonzero_p () const final override;
virtual bool contains_zero_p () const final override;
virtual void set (tree, tree, value_range_kind = VR_RANGE) final override;
virtual tree type () const final override;
@@ -524,7 +521,6 @@ public:
bool singleton_p (tree * = NULL) const final override;
bool contains_p (tree) const final override;
bool zero_p () const final override;
- bool nonzero_p () const final override;
bool contains_zero_p () const final override;
void set_nonzero (tree type) final override;
void set_zero (tree type) final override;
@@ -637,7 +633,6 @@ public:
virtual bool supports_type_p (const_tree type) const override;
virtual void accept (const vrange_visitor &v) const override;
virtual bool zero_p () const override;
- virtual bool nonzero_p () const override;
virtual bool contains_zero_p () const override;
virtual void set_nonzero (tree type) override;
virtual void set_zero (tree type) override;
@@ -890,7 +885,6 @@ public:
void set_zero (tree type) { init (type); return m_vrange->set_zero (type); }
void set_nonzero (tree type)
{ init (type); return m_vrange->set_nonzero (type); }
- bool nonzero_p () const { return m_vrange->nonzero_p (); }
bool contains_zero_p () const { return m_vrange->contains_zero_p (); }
bool zero_p () const { return m_vrange->zero_p (); }
tree lbound () const { return m_vrange->lbound (); }
@@ -1133,16 +1127,6 @@ irange::zero_p () const
&& upper_bound (0) == 0);
}
-inline bool
-irange::nonzero_p () const
-{
- if (undefined_p ())
- return false;
-
- wide_int zero = wi::zero (TYPE_PRECISION (type ()));
- return *this == int_range<2> (type (), zero, zero, VR_ANTI_RANGE);
-}
-
inline bool
irange::contains_zero_p () const
{
@@ -1480,12 +1464,6 @@ prange::zero_p () const
return ret;
}
-inline bool
-prange::nonzero_p () const
-{
- return m_kind == VR_RANGE && m_min == 1 && m_max == -1;
-}
-
inline bool
prange::contains_zero_p () const
{