[COMMITTED] Make irange::intersect(wide_int, wide_int) private.
Commit Message
[I will be committing a series of small, hopefully non-intrusive
cleanups to trunk in preparation for work to be done later this cycle
that will definitely be invasive ;-). If these changes turn out to be
remotely problematic, I can revert them, but I'm trying to get them in
early because I'm leaving on a 6 week paternity leave on May 9th and
would prefer the wider testing before departing.]
This method should have been private, and somehow seeped into the API.
Tested and benchmarked on x86-64 Linux.
gcc/ChangeLog:
* gimple-range-cache.h (non_null_ref::adjust_range): Do not use
irange::intersect (wide_int, wide_int).
* gimple-range-fold.cc (adjust_pointer_diff_expr): Same.
(adjust_imagpart_expr): Same.
* value-range.h (irange::intersect (wide_int, wide_int)): Make
private.
---
gcc/gimple-range-cache.h | 6 ++++--
gcc/gimple-range-fold.cc | 6 +++---
gcc/value-range.h | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
@@ -64,8 +64,10 @@ non_null_ref::adjust_range (irange &r, tree name, basic_block bb,
if (non_null_deref_p (name, bb, search_dom))
{
// Remove zero from the range.
- unsigned prec = TYPE_PRECISION (TREE_TYPE (name));
- r.intersect (wi::one (prec), wi::max_value (prec, UNSIGNED));
+ gcc_checking_assert (TYPE_UNSIGNED (TREE_TYPE (name)));
+ int_range<2> nz;
+ nz.set_nonzero (TREE_TYPE (name));
+ r.intersect (nz);
return true;
}
return false;
@@ -362,7 +362,7 @@ adjust_pointer_diff_expr (irange &res, const gimple *diff_stmt)
tree max = vrp_val_max (ptrdiff_type_node);
unsigned prec = TYPE_PRECISION (TREE_TYPE (max));
wide_int wmaxm1 = wi::to_wide (max, prec) - 1;
- res.intersect (wi::zero (prec), wmaxm1);
+ res.intersect (int_range<2> (TREE_TYPE (max), wi::zero (prec), wmaxm1));
}
}
@@ -403,8 +403,8 @@ adjust_imagpart_expr (irange &res, const gimple *stmt)
tree cst = gimple_assign_rhs1 (def_stmt);
if (TREE_CODE (cst) == COMPLEX_CST)
{
- wide_int imag = wi::to_wide (TREE_IMAGPART (cst));
- res.intersect (imag, imag);
+ int_range<2> imag (TREE_IMAGPART (cst), TREE_IMAGPART (cst));
+ res.intersect (imag);
}
}
}
@@ -73,7 +73,6 @@ public:
// In-place operators.
void union_ (const irange &);
void intersect (const irange &);
- void intersect (const wide_int& lb, const wide_int& ub);
void invert ();
// Operator overloads.
@@ -135,6 +134,7 @@ private:
void irange_set_1bit_anti_range (tree, tree);
bool varying_compatible_p () const;
+ void intersect (const wide_int& lb, const wide_int& ub);
unsigned char m_num_ranges;
unsigned char m_max_ranges;
ENUM_BITFIELD(value_range_kind) m_kind : 8;