From: Aldy Hernandez <aldyh@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/5] fend off anti-ranges from value-range-storage
Date: Wed, 1 Mar 2023 11:10:43 +0100 [thread overview]
Message-ID: <CAGm3qMWWLu0kXEQcVKo_4-aRFp2=WiQ2g1m7hptCzujicScpWg@mail.gmail.com> (raw)
In-Reply-To: <20230228134725.02E8813440@imap2.suse-dmz.suse.de>
OK.
Thanks.
On Tue, Feb 28, 2023 at 2:48 PM Richard Biener via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> The following avoids the need to special-case storage requirement
> and copying for irange_storage_slot by making sure we canonicalize
> such ranges to int_range<2>.
>
> * tree-ssanames.cc (range_info_set_range): If receiving
> an anti-range recurse with a temporary int_range<2>.
> * value-range-storage.cc (irange_storage_slot::size):
> Assert we're not asking for a VR_ANTI_RANGE.
> ---
> gcc/tree-ssanames.cc | 3 +++
> gcc/value-range-storage.cc | 2 +-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
> index 08aa166ef17..23468958586 100644
> --- a/gcc/tree-ssanames.cc
> +++ b/gcc/tree-ssanames.cc
> @@ -127,6 +127,9 @@ range_info_get_range (tree name, vrange &r)
> inline bool
> range_info_set_range (tree name, const vrange &r)
> {
> + if (r.kind () == VR_ANTI_RANGE)
> + return range_info_set_range (name, int_range<2> (as_a <irange> (r)));
> +
> if (!range_info_p (name) || !range_info_fits_p (name, r))
> {
> if (range_info_p (name))
> diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc
> index bf23f6dd476..79ab2921a03 100644
> --- a/gcc/value-range-storage.cc
> +++ b/gcc/value-range-storage.cc
> @@ -182,7 +182,7 @@ irange_storage_slot::get_irange (irange &r, tree type) const
> size_t
> irange_storage_slot::size (const irange &r)
> {
> - gcc_checking_assert (!r.undefined_p ());
> + gcc_checking_assert (!r.undefined_p () && r.kind () != VR_ANTI_RANGE);
>
> unsigned prec = TYPE_PRECISION (r.type ());
> unsigned n = num_wide_ints_needed (r);
> --
> 2.35.3
>
prev parent reply other threads:[~2023-03-01 10:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 13:47 Richard Biener
2023-03-01 10:10 ` Aldy Hernandez [this message]
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='CAGm3qMWWLu0kXEQcVKo_4-aRFp2=WiQ2g1m7hptCzujicScpWg@mail.gmail.com' \
--to=aldyh@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).