Commit 9716cc3e by Jan Hubicka

ipa-devirt.c (odr_type_warn_count): Add type.

	* ipa-devirt.c (odr_type_warn_count): Add type.
	(possible_polymorphic_call_targets): Set it.
	(ipa_devirt): Use it.

From-SVN: r213526
parent 62e4eb35
2014-08-01 Jan Hubicka <hubicka@ucw.cz> 2014-08-01 Jan Hubicka <hubicka@ucw.cz>
* ipa-devirt.c (odr_type_warn_count): Add type.
(possible_polymorphic_call_targets): Set it.
(ipa_devirt): Use it.
2014-08-01 Jan Hubicka <hubicka@ucw.cz>
* doc/invoke.texi (Wsuggest-final-types, Wsuggest-final-methods): Document. * doc/invoke.texi (Wsuggest-final-types, Wsuggest-final-methods): Document.
* ipa-devirt.c: Include hash-map.h * ipa-devirt.c: Include hash-map.h
(struct polymorphic_call_target_d): Add type_warning and decl_warning. (struct polymorphic_call_target_d): Add type_warning and decl_warning.
...@@ -24,14 +30,14 @@ ...@@ -24,14 +30,14 @@
* hash-map.h (default_hashmap_traits::mark_key_deleted): * hash-map.h (default_hashmap_traits::mark_key_deleted):
Fix cast. Fix cast.
(hash_map::remove): New method. (hash_map::remove): New method.
(hash_map::traverse): New method. (hash_map::traverse): New method.
* cgraph.h, except.c, except.h, gimple-ssa-strength-reduction.c, * cgraph.h, except.c, except.h, gimple-ssa-strength-reduction.c,
ipa-utils.c, lto-cgraph.c, lto-streamer.h, omp-low.c, predict.c, ipa-utils.c, lto-cgraph.c, lto-streamer.h, omp-low.c, predict.c,
tree-cfg.c, tree-cfgcleanup.c, tree-eh.c, tree-eh.h, tree-inline.c, tree-cfg.c, tree-cfgcleanup.c, tree-eh.c, tree-eh.h, tree-inline.c,
tree-inline.h, tree-nested.c, tree-sra.c, tree-ssa-loop-im.c, tree-inline.h, tree-nested.c, tree-sra.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-reassoc.c, tree-ssa-structalias.c, tree-ssa-loop-ivopts.c, tree-ssa-reassoc.c, tree-ssa-structalias.c,
tree-ssa.c, tree-ssa.h, var-tracking.c: Use hash_map instead of tree-ssa.c, tree-ssa.h, var-tracking.c: Use hash_map instead of
pointer_map. pointer_map.
2014-08-02 Trevor Saunders <tsaunders@mozilla.com> 2014-08-02 Trevor Saunders <tsaunders@mozilla.com>
......
...@@ -2518,6 +2518,7 @@ devirt_variable_node_removal_hook (varpool_node *n, ...@@ -2518,6 +2518,7 @@ devirt_variable_node_removal_hook (varpool_node *n,
/* Record about how many calls would benefit from given type to be final. */ /* Record about how many calls would benefit from given type to be final. */
struct odr_type_warn_count struct odr_type_warn_count
{ {
tree type;
int count; int count;
gcov_type dyn_count; gcov_type dyn_count;
}; };
...@@ -2738,6 +2739,7 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -2738,6 +2739,7 @@ possible_polymorphic_call_targets (tree otr_type,
if (binfo) if (binfo)
matched_vtables.add (BINFO_VTABLE (binfo)); matched_vtables.add (BINFO_VTABLE (binfo));
/* Next walk recursively all derived types. */ /* Next walk recursively all derived types. */
if (context.speculative_maybe_derived_type) if (context.speculative_maybe_derived_type)
for (i = 0; i < speculative_outer_type->derived_types.length(); i++) for (i = 0; i < speculative_outer_type->derived_types.length(); i++)
...@@ -2818,6 +2820,8 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -2818,6 +2820,8 @@ possible_polymorphic_call_targets (tree otr_type,
final_warning_records->type_warnings[outer_type->id].count++; final_warning_records->type_warnings[outer_type->id].count++;
final_warning_records->type_warnings[outer_type->id].dyn_count final_warning_records->type_warnings[outer_type->id].dyn_count
+= final_warning_records->dyn_count; += final_warning_records->dyn_count;
final_warning_records->type_warnings[outer_type->id].type
= outer_type->type;
(*slot)->type_warning = outer_type->id + 1; (*slot)->type_warning = outer_type->id + 1;
} }
if (complete if (complete
...@@ -3274,12 +3278,12 @@ ipa_devirt (void) ...@@ -3274,12 +3278,12 @@ ipa_devirt (void)
i < final_warning_records->type_warnings.length (); i++) i < final_warning_records->type_warnings.length (); i++)
if (final_warning_records->type_warnings[i].count) if (final_warning_records->type_warnings[i].count)
{ {
odr_type type = odr_types[i]; tree type = final_warning_records->type_warnings[i].type;
warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (type->type)), warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (type)),
OPT_Wsuggest_final_types, OPT_Wsuggest_final_types,
"Declaring type %qD final " "Declaring type %qD final "
"would enable devirtualization of %i calls", "would enable devirtualization of %i calls",
type->type, type,
final_warning_records->type_warnings[i].count); final_warning_records->type_warnings[i].count);
} }
} }
......
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