aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2022-09-14 08:29:54 +0200
committerAldy Hernandez <aldyh@redhat.com>2022-09-14 17:06:48 +0200
commit4a311a6160b3def190e64ca4a05a03fbcd163598 (patch)
tree34432d6b96408992c4598edeecdf9fe8d676628e /gcc/value-range.cc
parent9c4c4186eb7ca0a62fc590edcbb3f8fc9a081e64 (diff)
downloadgcc-4a311a6160b3def190e64ca4a05a03fbcd163598.zip
gcc-4a311a6160b3def190e64ca4a05a03fbcd163598.tar.gz
gcc-4a311a6160b3def190e64ca4a05a03fbcd163598.tar.bz2
Use frange::set_nan() from the generic frange::set().
This patch cleans up the frange::set() code by passing all things NAN to frange::set_nan(). No functional changes. Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * value-range.cc (frange::set): Use set_nan. * value-range.h (frange::set_nan): Inline code originally in set().
Diffstat (limited to 'gcc/value-range.cc')
-rw-r--r--gcc/value-range.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index dd82742..d759fcf 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -369,32 +369,33 @@ frange::set (tree min, tree max, value_range_kind kind)
return;
}
+ // Handle NANs.
+ if (real_isnan (TREE_REAL_CST_PTR (min)) || real_isnan (TREE_REAL_CST_PTR (max)))
+ {
+ gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min),
+ TREE_REAL_CST_PTR (max)));
+ tree type = TREE_TYPE (min);
+ set_nan (type);
+ return;
+ }
+
m_kind = kind;
m_type = TREE_TYPE (min);
m_props.set_varying ();
m_min = *TREE_REAL_CST_PTR (min);
m_max = *TREE_REAL_CST_PTR (max);
- bool is_nan = (real_isnan (TREE_REAL_CST_PTR (min))
- || real_isnan (TREE_REAL_CST_PTR (max)));
-
- // Ranges with a NAN and a non-NAN endpoint are nonsensical.
- gcc_checking_assert (!is_nan || operand_equal_p (min, max));
-
- // Set NAN property if we're absolutely sure.
- if (is_nan && operand_equal_p (min, max))
- m_props.nan_set_yes ();
- else if (!HONOR_NANS (m_type))
- m_props.nan_set_no ();
-
// Set SIGNBIT property for positive and negative ranges.
if (real_less (&m_max, &dconst0))
m_props.signbit_set_yes ();
else if (real_less (&dconst0, &m_min))
m_props.signbit_set_no ();
+ if (!HONOR_NANS (m_type))
+ m_props.nan_set_no ();
+
// Check for swapped ranges.
- gcc_checking_assert (is_nan || tree_compare (LE_EXPR, min, max));
+ gcc_checking_assert (tree_compare (LE_EXPR, min, max));
normalize_kind ();
if (flag_checking)