Skip to content

Commit

Permalink
Remove irange::constant_p.
Browse files Browse the repository at this point in the history
gcc/ChangeLog:

	* value-range-pretty-print.cc (vrange_printer::visit): Remove
	constant_p use.
	* value-range.cc (irange::constant_p): Remove.
	(irange::get_nonzero_bits_from_range): Remove constant_p use.
	* value-range.h (class irange): Remove constant_p.
	(irange::num_pairs): Remove constant_p use.
  • Loading branch information
aldyh committed Apr 26, 2023
1 parent a38bb14 commit 964b02c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
13 changes: 0 additions & 13 deletions gcc/value-range-pretty-print.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,6 @@ vrange_printer::visit (const irange &r) const
pp_string (pp, "VARYING");
return;
}
// Handle legacy symbolics.
if (!r.constant_p ())
{
if (r.kind () == VR_ANTI_RANGE)
pp_character (pp, '~');
pp_character (pp, '[');
dump_generic_node (pp, r.min (), 0, TDF_NONE, false);
pp_string (pp, ", ");
dump_generic_node (pp, r.max (), 0, TDF_NONE, false);
pp_character (pp, ']');
print_irange_bitmasks (r);
return;
}
for (unsigned i = 0; i < r.num_pairs (); ++i)
{
pp_character (pp, '[');
Expand Down
14 changes: 0 additions & 14 deletions gcc/value-range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1351,16 +1351,6 @@ irange::operator== (const irange &other) const
return nz1 == nz2;
}

/* Return TRUE if this is a constant range. */

bool
irange::constant_p () const
{
return (m_num_ranges > 0
&& TREE_CODE (min ()) == INTEGER_CST
&& TREE_CODE (max ()) == INTEGER_CST);
}

/* If range is a singleton, place it in RESULT and return TRUE.
Note: A singleton can be any gimple invariant, not just constants.
So, [&x, &x] counts as a singleton. */
Expand Down Expand Up @@ -2835,10 +2825,6 @@ irange::invert ()
wide_int
irange::get_nonzero_bits_from_range () const
{
// For legacy symbolics.
if (!constant_p ())
return wi::shwi (-1, TYPE_PRECISION (type ()));

wide_int min = lower_bound ();
wide_int max = upper_bound ();
wide_int xorv = min ^ max;
Expand Down
8 changes: 6 additions & 2 deletions gcc/value-range.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class GTY((user)) irange : public vrange
// Deprecated legacy public methods.
tree min () const; // DEPRECATED
tree max () const; // DEPRECATED
bool constant_p () const; // DEPRECATED
bool legacy_verbose_union_ (const class irange *); // DEPRECATED
bool legacy_verbose_intersect (const irange *); // DEPRECATED

Expand Down Expand Up @@ -692,7 +691,12 @@ inline unsigned
irange::num_pairs () const
{
if (m_kind == VR_ANTI_RANGE)
return constant_p () ? 2 : 1;
{
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;
}
Expand Down

0 comments on commit 964b02c

Please sign in to comment.