From: Jakub Jelinek <jakub@redhat.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>,
Andrew MacLeod <amacleod@redhat.com>,
Richard Biener <richard.guenther@gmail.com>
Subject: Re: [PATCH] Add inchash support for vrange.
Date: Tue, 18 Apr 2023 12:59:51 +0200 [thread overview]
Message-ID: <ZD54Jyw5JIY8nB+J@tucnak> (raw)
In-Reply-To: <6acb5cf5-43ab-7139-ac7f-6006dc3641c4@redhat.com>
On Tue, Apr 18, 2023 at 12:50:58PM +0200, Aldy Hernandez wrote:
> --- a/gcc/value-range.cc
> +++ b/gcc/value-range.cc
> @@ -232,6 +232,58 @@ vrange::dump (FILE *file) const
> pp_flush (&buffer);
> }
>
> +namespace inchash
> +{
> +
> +void
> +add_vrange (const vrange &v, inchash::hash &hstate,
> + unsigned int)
> +{
> + if (v.undefined_p ())
> + {
> + hstate.add_int (VR_UNDEFINED);
> + return;
> + }
> + // Types are ignored throughout to inhibit two ranges being equal
> + // but having different hash values. This can happen when two
> + // ranges are equal and their types are different (but
> + // types_compatible_p is true).
> + if (is_a <irange> (v))
> + {
> + const irange &r = as_a <irange> (v);
> + if (r.varying_p ())
> + hstate.add_int (VR_VARYING);
> + else
> + hstate.add_int (VR_RANGE);
Shouldn't this also
hstate.add_int (r.num_pairs ());
?
Or is that unnecessary because different number of add_wide_int
calls will likely result in different hashes then?
Otherwise LGTM.
> + for (unsigned i = 0; i < r.num_pairs (); ++i)
> + {
> + hstate.add_wide_int (r.lower_bound (i));
> + hstate.add_wide_int (r.upper_bound (i));
> + }
> + hstate.add_wide_int (r.get_nonzero_bits ());
> + return;
> + }
Jakub
next prev parent reply other threads:[~2023-04-18 10:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 9:06 [PATCH] Add support for vrange streaming Aldy Hernandez
2023-04-18 9:06 ` [PATCH] Add inchash support for vrange Aldy Hernandez
2023-04-18 9:17 ` Aldy Hernandez
2023-04-18 9:33 ` Jakub Jelinek
2023-04-18 10:32 ` Jakub Jelinek
2023-04-18 10:50 ` Aldy Hernandez
2023-04-18 10:59 ` Jakub Jelinek [this message]
2023-04-18 11:33 ` Aldy Hernandez
2023-04-18 11:34 ` Jakub Jelinek
2023-04-18 12:48 ` [PATCH] Add support for vrange streaming Aldy Hernandez
2023-04-27 11:00 ` Richard Biener
2023-04-27 11:36 ` Aldy Hernandez
2023-05-17 14:08 ` 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=ZD54Jyw5JIY8nB+J@tucnak \
--to=jakub@redhat.com \
--cc=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
/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).