From: Aldy Hernandez Date: Wed, 14 Nov 2018 16:29:41 +0000 (+0000) Subject: * gimple-ssa-evrp-analyze.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff361cc65f8e90aa77884c93d77e592cc470d6b7;p=gcc.git * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::record_ranges_from_incoming_edge): Rename ignore_equivs_equal_p to equal_p. * ipa-cp.c (meet_with_1): Use equal_p instead of ignore_equivs_equal_p. * ipa-prop.c (ipa_vr_ggc_hash_traits::equal): Same. * tree-vrp.c (value_range::ignore_equivs_equal_p): Remove. (value_range::operator==): Remove. (value_range::operator!=): Remove. (vrp_prop::visit_stmt): Use equal_p. * tree-vrp.h (value_range): Remove operator==, operator!=, ignore_equivs_equal_p. * vr-values.c (update_value_range): Use equal_p. From-SVN: r266150 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f83b0edda63..3efd96b570e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2018-11-14 Aldy Hernandez + + * gimple-ssa-evrp-analyze.c + (evrp_range_analyzer::record_ranges_from_incoming_edge): Rename + ignore_equivs_equal_p to equal_p. + * ipa-cp.c (meet_with_1): Use equal_p instead of + ignore_equivs_equal_p. + * ipa-prop.c (ipa_vr_ggc_hash_traits::equal): Same. + * tree-vrp.c (value_range::ignore_equivs_equal_p): Remove. + (value_range::operator==): Remove. + (value_range::operator!=): Remove. + (vrp_prop::visit_stmt): Use equal_p. + * tree-vrp.h (value_range): Remove operator==, operator!=, + ignore_equivs_equal_p. + * vr-values.c (update_value_range): Use equal_p. + 2018-11-14 Michael Matz PR middle-end/86575 diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c index bd11eea12b4..220dde093b5 100644 --- a/gcc/gimple-ssa-evrp-analyze.c +++ b/gcc/gimple-ssa-evrp-analyze.c @@ -209,7 +209,7 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb) value_range *old_vr = get_value_range (vrs[i].first); value_range tem (old_vr->kind (), old_vr->min (), old_vr->max ()); tem.intersect (vrs[i].second); - if (tem.ignore_equivs_equal_p (*old_vr)) + if (tem.equal_p (*old_vr, /*ignore_equivs=*/true)) continue; push_value_range (vrs[i].first, vrs[i].second); if (is_fallthru diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 81da108fb62..6b9dc8cb08f 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -928,7 +928,7 @@ ipcp_vr_lattice::meet_with_1 (const value_range_base *other_vr) value_range_base save (m_vr); m_vr.union_ (other_vr); - return !m_vr.ignore_equivs_equal_p (save); + return !m_vr.equal_p (save); } /* Return true if value range information in the lattice is yet unknown. */ diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index c779d865315..74052350ac1 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -121,7 +121,7 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove static bool equal (const value_range_base *a, const value_range_base *b) { - return a->ignore_equivs_equal_p (*b); + return a->equal_p (*b); } static void mark_empty (value_range_base *&p) diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index f498386e8eb..53d5bd6bd0c 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -210,37 +210,27 @@ value_range::check () } } -/* Returns TRUE if THIS == OTHER. Ignores the equivalence bitmap if - IGNORE_EQUIVS is TRUE. */ - -bool -value_range::equal_p (const value_range &other, bool ignore_equivs) const -{ - return (ignore_equivs_equal_p (other) - && (ignore_equivs - || vrp_bitmap_equal_p (m_equiv, other.m_equiv))); -} - -/* Return equality while ignoring equivalence bitmap. */ +/* Equality operator. We purposely do not overload ==, to avoid + confusion with the equality bitmap in the derived value_range + class. */ bool -value_range_base::ignore_equivs_equal_p (const value_range_base &other) const +value_range_base::equal_p (const value_range_base &other) const { return (m_kind == other.m_kind && vrp_operand_equal_p (m_min, other.m_min) && vrp_operand_equal_p (m_max, other.m_max)); } -bool -value_range::operator== (const value_range &other) const -{ - return equal_p (other, /*ignore_equivs=*/false); -} +/* Returns TRUE if THIS == OTHER. Ignores the equivalence bitmap if + IGNORE_EQUIVS is TRUE. */ bool -value_range::operator!= (const value_range &other) const +value_range::equal_p (const value_range &other, bool ignore_equivs) const { - return !(*this == other); + return (value_range_base::equal_p (other) + && (ignore_equivs + || vrp_bitmap_equal_p (m_equiv, other.m_equiv))); } /* Return TRUE if this is a symbolic range. */ @@ -5382,7 +5372,7 @@ vrp_prop::visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p) value_range new_vr; extract_range_basic (&new_vr, use_stmt); const value_range *old_vr = get_value_range (use_lhs); - if (*old_vr != new_vr) + if (!old_vr->equal_p (new_vr, /*ignore_equivs=*/false)) res = SSA_PROP_INTERESTING; else res = SSA_PROP_NOT_INTERESTING; diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h index 287860399c4..de3221e401c 100644 --- a/gcc/tree-vrp.h +++ b/gcc/tree-vrp.h @@ -63,7 +63,9 @@ public: void union_ (const value_range_base *); - bool ignore_equivs_equal_p (const value_range_base &) const; + bool operator== (const value_range_base &) const /* = delete */; + bool operator!= (const value_range_base &) const /* = delete */; + bool equal_p (const value_range_base &) const; /* Misc methods. */ tree type () const; @@ -119,10 +121,11 @@ class GTY((user)) value_range : public value_range_base void set_nonnull (tree); void set_null (tree); - bool operator== (const value_range &) const; - bool operator!= (const value_range &) const; + bool operator== (const value_range &) const /* = delete */; + bool operator!= (const value_range &) const /* = delete */; void intersect (const value_range *); void union_ (const value_range *); + bool equal_p (const value_range &, bool ignore_equivs) const; /* Types of value ranges. */ void set_undefined (); @@ -142,7 +145,6 @@ class GTY((user)) value_range : public value_range_base /* Deep-copies bitmap argument. */ void set_equiv (bitmap); void check (); - bool equal_p (const value_range &, bool ignore_equivs) const; void intersect_helper (value_range *, const value_range *); /* Set of SSA names whose value ranges are equivalent to this one. diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 86829041358..41862b97601 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -180,7 +180,7 @@ vr_values::update_value_range (const_tree var, value_range *new_vr) /* Update the value range, if necessary. */ old_vr = get_value_range (var); - is_new = *old_vr != *new_vr; + is_new = !old_vr->equal_p (*new_vr, /*ignore_equivs=*/false); if (is_new) {