public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2816] frange: Make the setter taking trees a wrapper. Date: Fri, 23 Sep 2022 12:59:03 +0000 (GMT) [thread overview] Message-ID: <20220923125903.2459A3857B80@sourceware.org> (raw) https://gcc.gnu.org/g:ab0f70a63011ff06eea64960e3b8ca66575bfdaf commit r13-2816-gab0f70a63011ff06eea64960e3b8ca66575bfdaf Author: Aldy Hernandez <aldyh@redhat.com> Date: Fri Sep 23 13:05:26 2022 +0200 frange: Make the setter taking trees a wrapper. The frange setter does all its work in trees. This incurs a penalty for the real_value variants because they must wrap their arguments into a tree and pass it to the tree setter, which will then do the opposite. This is leftovers from the irange setter. Even though the we still need constructors taking trees so we can interact with the tree world, there's no sense penalizing the rest of the implementation. Tested on x86-64 Linux. gcc/ChangeLog: * value-range.cc (frange::set): Swap setters such that the one accepting REAL_VALUE_TYPE does all the work. Diff: --- gcc/value-range.cc | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 43905ba4901..9ca442478c9 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -290,7 +290,9 @@ frange::flush_denormals_to_zero () // Setter for franges. void -frange::set (tree min, tree max, value_range_kind kind) +frange::set (tree type, + const REAL_VALUE_TYPE &min, const REAL_VALUE_TYPE &max, + value_range_kind kind) { switch (kind) { @@ -299,7 +301,7 @@ frange::set (tree min, tree max, value_range_kind kind) return; case VR_VARYING: case VR_ANTI_RANGE: - set_varying (TREE_TYPE (min)); + set_varying (type); return; case VR_RANGE: break; @@ -308,14 +310,12 @@ frange::set (tree min, tree max, value_range_kind kind) } // Handle NANs. - if (real_isnan (TREE_REAL_CST_PTR (min)) || real_isnan (TREE_REAL_CST_PTR (max))) + if (real_isnan (&min) || real_isnan (&max)) { - gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min), - TREE_REAL_CST_PTR (max))); - tree type = TREE_TYPE (min); + gcc_checking_assert (real_identical (&min, &max)); if (HONOR_NANS (type)) { - bool sign = real_isneg (TREE_REAL_CST_PTR (min)); + bool sign = real_isneg (&min); set_nan (type, sign); } else @@ -324,9 +324,9 @@ frange::set (tree min, tree max, value_range_kind kind) } m_kind = kind; - m_type = TREE_TYPE (min); - m_min = *TREE_REAL_CST_PTR (min); - m_max = *TREE_REAL_CST_PTR (max); + m_type = type; + m_min = min; + m_max = max; if (HONOR_NANS (m_type)) { m_pos_nan = true; @@ -351,7 +351,7 @@ frange::set (tree min, tree max, value_range_kind kind) } // Check for swapped ranges. - gcc_checking_assert (tree_compare (LE_EXPR, min, max)); + gcc_checking_assert (real_compare (LE_EXPR, &min, &max)); normalize_kind (); @@ -361,14 +361,11 @@ frange::set (tree min, tree max, value_range_kind kind) verify_range (); } -// Setter for frange from REAL_VALUE_TYPE endpoints. - void -frange::set (tree type, - const REAL_VALUE_TYPE &min, const REAL_VALUE_TYPE &max, - value_range_kind kind) +frange::set (tree min, tree max, value_range_kind kind) { - set (build_real (type, min), build_real (type, max), kind); + set (TREE_TYPE (min), + *TREE_REAL_CST_PTR (min), *TREE_REAL_CST_PTR (max), kind); } // Normalize range to VARYING or UNDEFINED, or vice versa. Return
reply other threads:[~2022-09-23 12:59 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220923125903.2459A3857B80@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).