From: Aldy Hernandez Date: Mon, 4 Nov 2019 21:41:12 +0000 (+0000) Subject: Use the value_range_base constructors in value_range_base::invert to X-Git-Tag: upstream/12.2.0~20686 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ced1d76b143b6856699f815813045d551e3cef9;p=platform%2Fupstream%2Fgcc.git Use the value_range_base constructors in value_range_base::invert to make sure we build canonically correct ranges. From-SVN: r277794 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c585360..6bdd5ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2019-11-04 Aldy Hernandez + * tree-vrp.c (value_range_base::invert): Use constructors to build + range. + +2019-11-04 Aldy Hernandez + * tree-vrp.c (range_int_cst_singleton_p): Remove. * tree-vrp.h (range_int_cst_singleton_p): Remove. diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 070db90..085308e 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6286,10 +6286,12 @@ value_range_base::contains_p (tree cst) const void 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) - m_kind = VR_ANTI_RANGE; + *this = value_range_base (VR_ANTI_RANGE, m_min, m_max); else if (m_kind == VR_ANTI_RANGE) - m_kind = VR_RANGE; + *this = value_range_base (VR_RANGE, m_min, m_max); else gcc_unreachable (); }