From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] Make irange::intersect(wide_int, wide_int) private.
Date: Fri, 29 Apr 2022 11:02:32 +0200 [thread overview]
Message-ID: <20220429090236.718140-1-aldyh@redhat.com> (raw)
[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(-)
diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index 589b649da26..a0244e4f6a4 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -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;
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index dfacf6f14dc..3169e29b5de 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -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);
}
}
}
diff --git a/gcc/value-range.h b/gcc/value-range.h
index d4cba22d540..fe7795b55a6 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -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;
--
2.35.1
next reply other threads:[~2022-04-29 9:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 9:02 Aldy Hernandez [this message]
2022-04-29 9:02 ` [COMMITTED] Call set_undefined from irange constructor Aldy Hernandez
2022-04-29 9:02 ` [COMMITTED] Prefer global range info setters that take a range Aldy Hernandez
2022-04-29 9:02 ` [COMMITTED] Remove various deprecated methods in class irange Aldy Hernandez
2022-04-29 9:02 ` [COMMITTED] Move common code from range-op.cc to header files Aldy Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220429090236.718140-1-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).