ipa-devirt.c (dump_targets): Cap number of targets printed.
authorJan Hubicka <hubicka@ucw.cz>
Mon, 24 Dec 2018 11:26:15 +0000 (12:26 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 24 Dec 2018 11:26:15 +0000 (11:26 +0000)
* 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

gcc/ChangeLog
gcc/ipa-devirt.c
gcc/ipa-utils.h

index dce70c8..65f87a3 100644 (file)
@@ -1,4 +1,12 @@
 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
        * tree.c (fld_simplified_type): Temporarily disable array
index 0f42d12..399a6e0 100644 (file)
@@ -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 <cgraph_node *> targets)
+dump_targets (FILE *f, vec <cgraph_node *> targets, bool verbose)
 {
   unsigned int i;
 
@@ -3471,6 +3471,13 @@ dump_targets (FILE *f, vec <cgraph_node *> 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 <cgraph_node *> 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++;
 
index b586935..02ce51b 100644 (file)
@@ -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