[committed] use value_range_base::num_pairs in singleton_p
diff mbox series

Message ID 553fda8a-6bc3-b560-c90a-f0068c3cbc49@redhat.com
State New
Headers show
Series
  • [committed] use value_range_base::num_pairs in singleton_p
Related show

Commit Message

Aldy Hernandez Oct. 7, 2019, 9:39 a.m. UTC
Instead of looking inside a range to determine if it has one sub-range, 
use the API.

Committed as obvious.

Aldy

Patch
diff mbox series

commit 93d4733dd1f8ce8ca4959f4584cec4bdd96d063e
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Oct 7 09:15:30 2019 +0200

    Use value_range_base::num_pairs instead of vrp_val_is* to check if a range
    has one sub-range.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 798d16cf0c6..fbb1634cbae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2019-10-07  Aldy Hernandez  <aldyh@redhat.com>
+
+	* tree-vrp.c (value_range_base::singleton_p): Use
+	value_range_base::num_pairs instead of vrp_val_is* to check
+	if a range has one sub-range.
+
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index a2ab4a21925..86e4dace073 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -379,10 +379,7 @@  value_range_base::singleton_p (tree *result) const
 	    }
 	  return false;
 	}
-
-      /* An anti-range that includes an extreme, is just a range with
-	 one sub-range.  Use the one sub-range.  */
-      if (vrp_val_is_min (m_min, true) || vrp_val_is_max (m_max, true))
+      if (num_pairs () == 1)
 	{
 	  value_range_base vr0, vr1;
 	  ranges_from_anti_range (this, &vr0, &vr1, true);