[gcc r13-1930] More frange::set cleanups.
Aldy Hernandez
aldyh@gcc.gnu.org
Tue Aug 2 12:56:52 GMT 2022
https://gcc.gnu.org/g:5e4f26441bdc89e95f0c257bc6649eed0142b939
commit r13-1930-g5e4f26441bdc89e95f0c257bc6649eed0142b939
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Mon Aug 1 20:19:49 2022 +0200
More frange::set cleanups.
gcc/ChangeLog:
* value-range.cc (frange::set): Initialize m_props and cleanup.
Diff:
---
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 ();
More information about the Gcc-cvs
mailing list