diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2018-12-27 22:23:30 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-12-27 21:23:30 +0000 |
commit | f7293b9dfab5e6e760f65934f76bbaa7184b0f45 (patch) | |
tree | 6a2c9e2c7738fe46774569842e7ff2063b3b67cb /gcc/ipa-devirt.c | |
parent | 03b2d3defa7ef8c258d48f4bfbd66a08c27ea19c (diff) |
ipa-devirt.c (polymorphic_call_target_d): Add n_odr_types.
* ipa-devirt.c (polymorphic_call_target_d): Add n_odr_types.
(polymorphic_call_target_hasher::hash): Hash it.
(polymorphic_call_target_hasher::equal): Compare it.
(possible_polymorphic_call_targets): Set it.
* tree.c (free_lang_data): Rebuild type inheritance graph even on
non-LTO path.
* g++.dg/ipa/devirt-53.C: New testcase.
From-SVN: r267438
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r-- | gcc/ipa-devirt.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 399a6e027cf..4ba0f0b330f 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2759,6 +2759,7 @@ struct polymorphic_call_target_d vec <cgraph_node *> targets; tree decl_warning; int type_warning; + unsigned int n_odr_types; bool complete; bool speculative; }; @@ -2784,6 +2785,7 @@ polymorphic_call_target_hasher::hash (const polymorphic_call_target_d *odr_query hstate.add_hwi (odr_query->type->id); hstate.merge_hash (TYPE_UID (odr_query->context.outer_type)); hstate.add_hwi (odr_query->context.offset); + hstate.add_hwi (odr_query->n_odr_types); if (odr_query->context.speculative_outer_type) { @@ -2814,7 +2816,9 @@ polymorphic_call_target_hasher::equal (const polymorphic_call_target_d *t1, == t2->context.maybe_in_construction && t1->context.maybe_derived_type == t2->context.maybe_derived_type && (t1->context.speculative_maybe_derived_type - == t2->context.speculative_maybe_derived_type)); + == t2->context.speculative_maybe_derived_type) + /* Adding new type may affect outcome of target search. */ + && t1->n_odr_types == t2->n_odr_types); } /* Remove entry in polymorphic call target cache hash. */ @@ -3220,6 +3224,7 @@ possible_polymorphic_call_targets (tree otr_type, key.otr_token = otr_token; key.speculative = speculative; key.context = context; + key.n_odr_types = odr_types.length (); slot = polymorphic_call_target_hash->find_slot (&key, INSERT); if (cache_token) *cache_token = (void *)*slot; @@ -3436,6 +3441,7 @@ possible_polymorphic_call_targets (tree otr_type, (*slot)->targets = nodes; (*slot)->complete = complete; + (*slot)->n_odr_types = odr_types.length (); if (completep) *completep = complete; |