Commit c1dd347c by Jan Hubicka Committed by Jan Hubicka

ipa-devirt.c (dump_targets): Cap number of targets printed.


	* ipa-devirt.c (dump_targets): Cap number of targets printed.
	(dump_possible_polymorphic_call_targets): Add verbose parameter.
	(ipa_devirt): Use it.
	* ipa-utils.h (dump_possible_polymorphic_call_targets): Add verbose
	parametrs.

From-SVN: r267400
parent 3d7bef8d
2018-12-24 Jan Hubicka <hubicka@ucw.cz> 2018-12-24 Jan Hubicka <hubicka@ucw.cz>
* ipa-devirt.c (dump_targets): Cap number of targets printed.
(dump_possible_polymorphic_call_targets): Add verbose parameter.
(ipa_devirt): Use it.
* ipa-utils.h (dump_possible_polymorphic_call_targets): Add verbose
parametrs.
2018-12-24 Jan Hubicka <hubicka@ucw.cz>
PR lto/88140 PR lto/88140
* tree.c (fld_simplified_type): Temporarily disable array * tree.c (fld_simplified_type): Temporarily disable array
...@@ -3454,7 +3454,7 @@ add_decl_warning (const tree &key ATTRIBUTE_UNUSED, const decl_warn_count &value ...@@ -3454,7 +3454,7 @@ add_decl_warning (const tree &key ATTRIBUTE_UNUSED, const decl_warn_count &value
/* Dump target list TARGETS into FILE. */ /* Dump target list TARGETS into FILE. */
static void static void
dump_targets (FILE *f, vec <cgraph_node *> targets) dump_targets (FILE *f, vec <cgraph_node *> targets, bool verbose)
{ {
unsigned int i; unsigned int i;
...@@ -3471,6 +3471,13 @@ dump_targets (FILE *f, vec <cgraph_node *> targets) ...@@ -3471,6 +3471,13 @@ dump_targets (FILE *f, vec <cgraph_node *> targets)
fprintf (f, " (no definition%s)", fprintf (f, " (no definition%s)",
DECL_DECLARED_INLINE_P (targets[i]->decl) DECL_DECLARED_INLINE_P (targets[i]->decl)
? " inline" : ""); ? " inline" : "");
/* With many targets for every call polymorphic dumps are going to
be quadratic in size. */
if (i > 10 && !verbose)
{
fprintf (f, " ... and %i more targets\n", targets.length () - i);
return;
}
} }
fprintf (f, "\n"); fprintf (f, "\n");
} }
...@@ -3481,7 +3488,8 @@ void ...@@ -3481,7 +3488,8 @@ void
dump_possible_polymorphic_call_targets (FILE *f, dump_possible_polymorphic_call_targets (FILE *f,
tree otr_type, tree otr_type,
HOST_WIDE_INT otr_token, HOST_WIDE_INT otr_token,
const ipa_polymorphic_call_context &ctx) const ipa_polymorphic_call_context &ctx,
bool verbose)
{ {
vec <cgraph_node *> targets; vec <cgraph_node *> targets;
bool final; bool final;
...@@ -3506,7 +3514,7 @@ dump_possible_polymorphic_call_targets (FILE *f, ...@@ -3506,7 +3514,7 @@ dump_possible_polymorphic_call_targets (FILE *f,
ctx.maybe_derived_type ? " (derived types included)" : "", ctx.maybe_derived_type ? " (derived types included)" : "",
ctx.speculative_maybe_derived_type ? " (speculative derived types included)" : ""); ctx.speculative_maybe_derived_type ? " (speculative derived types included)" : "");
len = targets.length (); len = targets.length ();
dump_targets (f, targets); dump_targets (f, targets, verbose);
targets = possible_polymorphic_call_targets (otr_type, otr_token, targets = possible_polymorphic_call_targets (otr_type, otr_token,
ctx, ctx,
...@@ -3514,7 +3522,7 @@ dump_possible_polymorphic_call_targets (FILE *f, ...@@ -3514,7 +3522,7 @@ dump_possible_polymorphic_call_targets (FILE *f,
if (targets.length () != len) if (targets.length () != len)
{ {
fprintf (f, " Speculative targets:"); fprintf (f, " Speculative targets:");
dump_targets (f, targets); dump_targets (f, targets, verbose);
} }
/* Ugly: during callgraph construction the target cache may get populated /* Ugly: during callgraph construction the target cache may get populated
before all targets are found. While this is harmless (because all local before all targets are found. While this is harmless (because all local
...@@ -3768,7 +3776,7 @@ ipa_devirt (void) ...@@ -3768,7 +3776,7 @@ ipa_devirt (void)
if (dump_file) if (dump_file)
dump_possible_polymorphic_call_targets dump_possible_polymorphic_call_targets
(dump_file, e); (dump_file, e, (dump_flags & TDF_DETAILS));
npolymorphic++; npolymorphic++;
......
...@@ -67,7 +67,8 @@ odr_type get_odr_type (tree, bool insert = false); ...@@ -67,7 +67,8 @@ odr_type get_odr_type (tree, bool insert = false);
bool odr_type_p (const_tree); bool odr_type_p (const_tree);
bool possible_polymorphic_call_target_p (tree ref, gimple *stmt, struct cgraph_node *n); bool possible_polymorphic_call_target_p (tree ref, gimple *stmt, struct cgraph_node *n);
void dump_possible_polymorphic_call_targets (FILE *, tree, HOST_WIDE_INT, void dump_possible_polymorphic_call_targets (FILE *, tree, HOST_WIDE_INT,
const ipa_polymorphic_call_context &); const ipa_polymorphic_call_context &,
bool verbose = true);
bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT, bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT,
const ipa_polymorphic_call_context &, const ipa_polymorphic_call_context &,
struct cgraph_node *); struct cgraph_node *);
...@@ -137,13 +138,14 @@ possible_polymorphic_call_targets (tree ref, ...@@ -137,13 +138,14 @@ possible_polymorphic_call_targets (tree ref,
/* Dump possible targets of a polymorphic call E into F. */ /* Dump possible targets of a polymorphic call E into F. */
inline void inline void
dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e) dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e,
bool verbose = true)
{ {
ipa_polymorphic_call_context context(e); ipa_polymorphic_call_context context(e);
dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type, dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type,
e->indirect_info->otr_token, e->indirect_info->otr_token,
context); context, verbose);
} }
/* Return true if N can be possibly target of a polymorphic call of /* Return true if N can be possibly target of a polymorphic call of
......
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