Commit 8ced1d76 by Aldy Hernandez Committed by Aldy Hernandez

Use the value_range_base constructors in value_range_base::invert to

make sure we build canonically correct ranges.

From-SVN: r277794
parent a1b68059
2019-11-04 Aldy Hernandez <aldyh@redhat.com> 2019-11-04 Aldy Hernandez <aldyh@redhat.com>
* tree-vrp.c (value_range_base::invert): Use constructors to build
range.
2019-11-04 Aldy Hernandez <aldyh@redhat.com>
* tree-vrp.c (range_int_cst_singleton_p): Remove. * tree-vrp.c (range_int_cst_singleton_p): Remove.
* tree-vrp.h (range_int_cst_singleton_p): Remove. * tree-vrp.h (range_int_cst_singleton_p): Remove.
...@@ -6286,10 +6286,12 @@ value_range_base::contains_p (tree cst) const ...@@ -6286,10 +6286,12 @@ value_range_base::contains_p (tree cst) const
void void
value_range_base::invert () value_range_base::invert ()
{ {
/* We can't just invert VR_RANGE and VR_ANTI_RANGE because we may
create non-canonical ranges. Use the constructors instead. */
if (m_kind == VR_RANGE) if (m_kind == VR_RANGE)
m_kind = VR_ANTI_RANGE; *this = value_range_base (VR_ANTI_RANGE, m_min, m_max);
else if (m_kind == VR_ANTI_RANGE) else if (m_kind == VR_ANTI_RANGE)
m_kind = VR_RANGE; *this = value_range_base (VR_RANGE, m_min, m_max);
else else
gcc_unreachable (); gcc_unreachable ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment