From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] More frange::set cleanups.
Date: Tue, 2 Aug 2022 14:24:05 +0200 [thread overview]
Message-ID: <20220802122407.336092-1-aldyh@redhat.com> (raw)
Will commit pending a final round of tests.
gcc/ChangeLog:
* value-range.cc (frange::set): Initialize m_props and cleanup.
---
gcc/value-range.cc | 47 +++++++++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 19 deletions(-)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index dc06f8b0078..dd5a4303908 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -292,38 +292,47 @@ frange::set (tree min, tree max, value_range_kind kind)
m_kind = kind;
m_type = TREE_TYPE (min);
-
- // Mark NANness.
- if (real_isnan (TREE_REAL_CST_PTR (min))
- || real_isnan (TREE_REAL_CST_PTR (max)))
- {
- gcc_checking_assert (operand_equal_p (min, max));
- m_props.nan_set_yes ();
- }
- else
- m_props.nan_set_no ();
+ m_props.set_varying ();
bool is_min = vrp_val_is_min (min);
bool is_max = vrp_val_is_max (max);
+ bool is_nan = (real_isnan (TREE_REAL_CST_PTR (min))
+ || real_isnan (TREE_REAL_CST_PTR (max)));
- // Mark when the endpoints can't be INF.
- if (!is_min)
- m_props.ninf_set_no ();
- if (!is_max)
- m_props.inf_set_no ();
+ // Ranges with a NAN and a non-NAN endpoint are nonsensical.
+ gcc_checking_assert (!is_nan || operand_equal_p (min, max));
- // Mark when the endpoints are definitely INF.
+ // The properties for singletons can be all set ahead of time.
if (operand_equal_p (min, max))
{
+ // Set INF properties.
if (is_min)
m_props.ninf_set_yes ();
- else if (is_max)
+ else
+ m_props.ninf_set_no ();
+ if (is_max)
m_props.inf_set_yes ();
+ else
+ m_props.inf_set_no ();
+ // Set NAN property.
+ if (is_nan)
+ m_props.nan_set_yes ();
+ else
+ m_props.nan_set_no ();
+ }
+ else
+ {
+ // Mark when the endpoints can't be +-INF.
+ if (!is_min)
+ m_props.ninf_set_no ();
+ if (!is_max)
+ m_props.inf_set_no ();
}
// Check for swapped ranges.
- gcc_checking_assert (m_props.nan_yes_p ()
- || tree_compare (LE_EXPR, min, max));
+ gcc_checking_assert (is_nan || tree_compare (LE_EXPR, min, max));
+
+ normalize_kind ();
if (flag_checking)
verify_range ();
--
2.37.1
next reply other threads:[~2022-08-02 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 12:24 Aldy Hernandez [this message]
2022-08-02 12:24 ` [PATCH] Limit ranger query in ipa-prop.cc to integrals Aldy Hernandez
2022-08-02 12:24 ` [PATCH] Implement streamer for frange 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=20220802122407.336092-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).