On 11/4/19 11:45 PM, Andrew MacLeod wrote:
On 11/4/19 5:23 PM, Aldy Hernandez wrote:
value_range_base::operator== was originally lifted from a world where
symbolics didn't exist (the ranger branch), but symbolics do exist in
mainline.
Although this isn't causing a problem yet, as soon as someone tries to
compare non numeric ranges, we'll die. Using operand_equal_p
simplifies the comparison code drastically.
I suppose if/when we get multiple sub-ranges in value_range_base,
we'll have to adapt this function again to compare things piece wise.
For now, let's keep things simple.
OK pending tests?
Oh, we brought over the multiple sub-range bits to value_range_base...
yeah we can remove that and just check for operand equality. we'll deal
with multiple subranges when thats a thing.
Is this any different than just calling value_range_base::equal_p()?
Ooops, indeed, that's the same thing.
Adjusted.
OK pending tests?
commit eb3ca5b2eeb84233a485981e140c6f910deb4bcc
Author: Aldy Hernandez <al...@redhat.com>
Date: Mon Nov 4 21:20:26 2019 +0100
Use value_range_base::equal_p in value_range_base::operator== so we can handle
symbolics without dying.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 254b3950a8e..b9f61791270 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-04 Aldy Hernandez <al...@redhat.com>
+
+ * tree-vrp.c (value_range_base::operator==): Use equal_p to
+ properly handle symbolics.
+
2019-11-04 Aldy Hernandez <al...@redhat.com>
* tree-vrp.c (value_range_base::set): Do not special case pointers.
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 452895bfc24..9d6a4ebc7fe 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6333,19 +6333,7 @@ range_compatible_p (tree t1, tree t2)
bool
value_range_base::operator== (const value_range_base &r) const
{
- if (undefined_p ())
- return r.undefined_p ();
-
- if (num_pairs () != r.num_pairs ()
- || !range_compatible_p (type (), r.type ()))
- return false;
-
- for (unsigned p = 0; p < num_pairs (); p++)
- if (wi::ne_p (lower_bound (p), r.lower_bound (p))
- || wi::ne_p (upper_bound (p), r.upper_bound (p)))
- return false;
-
- return true;
+ return equal_p (r);
}
/* Visit all arguments for PHI node PHI that flow through executable