From: Jan Hubicka Date: Mon, 24 Dec 2018 11:26:15 +0000 (+0100) Subject: ipa-devirt.c (dump_targets): Cap number of targets printed. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c1dd347cbd7c1ac87b750a9100dfbde2f2190c63;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dce70c80634..65f87a3ddfa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-12-24 Jan Hubicka + + * 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 PR lto/88140 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 0f42d124fe3..399a6e027cf 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -3454,7 +3454,7 @@ add_decl_warning (const tree &key ATTRIBUTE_UNUSED, const decl_warn_count &value /* Dump target list TARGETS into FILE. */ static void -dump_targets (FILE *f, vec targets) +dump_targets (FILE *f, vec targets, bool verbose) { unsigned int i; @@ -3471,6 +3471,13 @@ dump_targets (FILE *f, vec targets) fprintf (f, " (no definition%s)", DECL_DECLARED_INLINE_P (targets[i]->decl) ? " 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"); } @@ -3481,7 +3488,8 @@ void dump_possible_polymorphic_call_targets (FILE *f, tree otr_type, HOST_WIDE_INT otr_token, - const ipa_polymorphic_call_context &ctx) + const ipa_polymorphic_call_context &ctx, + bool verbose) { vec targets; bool final; @@ -3506,7 +3514,7 @@ dump_possible_polymorphic_call_targets (FILE *f, ctx.maybe_derived_type ? " (derived types included)" : "", ctx.speculative_maybe_derived_type ? " (speculative derived types included)" : ""); len = targets.length (); - dump_targets (f, targets); + dump_targets (f, targets, verbose); targets = possible_polymorphic_call_targets (otr_type, otr_token, ctx, @@ -3514,7 +3522,7 @@ dump_possible_polymorphic_call_targets (FILE *f, if (targets.length () != len) { fprintf (f, " Speculative targets:"); - dump_targets (f, targets); + dump_targets (f, targets, verbose); } /* Ugly: during callgraph construction the target cache may get populated before all targets are found. While this is harmless (because all local @@ -3768,7 +3776,7 @@ ipa_devirt (void) if (dump_file) dump_possible_polymorphic_call_targets - (dump_file, e); + (dump_file, e, (dump_flags & TDF_DETAILS)); npolymorphic++; diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h index b58693528d8..02ce51b6083 100644 --- a/gcc/ipa-utils.h +++ b/gcc/ipa-utils.h @@ -67,7 +67,8 @@ odr_type get_odr_type (tree, bool insert = false); bool odr_type_p (const_tree); 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, - const ipa_polymorphic_call_context &); + const ipa_polymorphic_call_context &, + bool verbose = true); bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT, const ipa_polymorphic_call_context &, struct cgraph_node *); @@ -137,13 +138,14 @@ possible_polymorphic_call_targets (tree ref, /* Dump possible targets of a polymorphic call E into F. */ 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); dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type, e->indirect_info->otr_token, - context); + context, verbose); } /* Return true if N can be possibly target of a polymorphic call of