Learn GIMPLE pretty printer to produce nicer dump output.
authorMartin Liska <mliska@suse.cz>
Mon, 31 Jul 2017 08:54:05 +0000 (10:54 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 31 Jul 2017 08:54:05 +0000 (08:54 +0000)
2017-07-31  Martin Liska  <mliska@suse.cz>

* gimple-pretty-print.c (dump_gimple_label): Never dump
BB info.
(dump_gimple_bb_header): Always dump BB info.
(pp_cfg_jump): Do not append info about BB when dumping a jump.
2017-07-31  Martin Liska  <mliska@suse.cz>

* gcc.dg/builtin-unreachable-6.c: Update scanned patterns.
* gcc.dg/tree-ssa/attr-hotcold-2.c: Likewise.

From-SVN: r250731

gcc/ChangeLog
gcc/gimple-pretty-print.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/builtin-unreachable-6.c
gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c

index 7da2b65fdc2b9b2be5c8a135122a21aa8ee64ade..ef0147633323a096fce95684aa8e52d3a5715cff 100644 (file)
@@ -1,3 +1,10 @@
+2017-07-31  Martin Liska  <mliska@suse.cz>
+
+       * gimple-pretty-print.c (dump_gimple_label): Never dump
+       BB info.
+       (dump_gimple_bb_header): Always dump BB info.
+       (pp_cfg_jump): Do not append info about BB when dumping a jump.
+
 2017-07-31  Martin Liska  <mliska@suse.cz>
 
        PR sanitize/81530
index c8eb9c4a7bff0f6a7a630b59aea72556f8553695..8b69b72e9e224ee8e1ad320fb6030b34637b83fb 100644 (file)
@@ -1120,9 +1120,6 @@ dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc,
   else
     {
       dump_generic_node (buffer, label, spc, flags, false);
-      basic_block bb = gimple_bb (gs);
-      if (bb && !(flags & TDF_GIMPLE))
-       pp_scalar (buffer, " %s", dump_profile (bb->frequency, bb->count));
       pp_colon (buffer);
     }
   if (flags & TDF_GIMPLE)
@@ -2695,16 +2692,12 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
     }
   else
     {
-      gimple *stmt = first_stmt (bb);
-      if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
-       {
-         if (flags & TDF_GIMPLE)
-           fprintf (outf, "%*sbb_%d:\n", indent, "", bb->index);
-         else
-           fprintf (outf, "%*s<bb %d> %s:\n",
-                    indent, "", bb->index, dump_profile (bb->frequency,
-                                                         bb->count));
-       }
+      if (flags & TDF_GIMPLE)
+       fprintf (outf, "%*sbb_%d:\n", indent, "", bb->index);
+      else
+       fprintf (outf, "%*s<bb %d> %s:\n",
+                indent, "", bb->index, dump_profile (bb->frequency,
+                                                     bb->count));
     }
 }
 
@@ -2760,22 +2753,10 @@ pp_cfg_jump (pretty_printer *buffer, edge e, dump_flags_t flags)
     }
   else
     {
-      gimple *stmt = first_stmt (e->dest);
-
       pp_string (buffer, "goto <bb ");
       pp_decimal_int (buffer, e->dest->index);
       pp_greater (buffer);
-      if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
-       {
-         pp_string (buffer, " (");
-         dump_generic_node (buffer,
-                            gimple_label_label (as_a <glabel *> (stmt)),
-                            0, 0, false);
-         pp_right_paren (buffer);
-         pp_semicolon (buffer);
-       }
-      else
-       pp_semicolon (buffer);
+      pp_semicolon (buffer);
 
       dump_edge_probability (buffer, e);
     }
index f0ef3ade89963c67d5db6eae2bfa98b0975357b1..f77d27ce53d12fa50ea9a7d45213dcc403a69e1d 100644 (file)
@@ -1,3 +1,8 @@
+2017-07-31  Martin Liska  <mliska@suse.cz>
+
+       * gcc.dg/builtin-unreachable-6.c: Update scanned patterns.
+       * gcc.dg/tree-ssa/attr-hotcold-2.c: Likewise.
+
 2017-07-31  Martin Liska  <mliska@suse.cz>
 
        PR sanitize/81530
index d2596e95c3fc30a506cc09817a51535c7dd87a79..2f8ca3695463fc6780d51c7f8f8db98e04a741dd 100644 (file)
@@ -16,5 +16,5 @@ lab2:
   goto *x;
 }
 
-/* { dg-final { scan-tree-dump-times "lab \\\[\[0-9.\]+%\\\]" 1 "fab1" } } */
+/* { dg-final { scan-tree-dump-times "lab:" 1 "fab1" } } */
 /* { dg-final { scan-tree-dump-times "__builtin_unreachable" 1 "fab1" } } */
index 184dd10ddaef6d70455dab2e08a4b3d65e55b0ed..5f7e3afa2ae6caeb9b784ed2e5966bf75a904faa 100644 (file)
@@ -20,9 +20,9 @@ void f(int x, int y)
 
 /* { dg-final { scan-tree-dump-times "hot label heuristics" 1 "profile_estimate" } } */
 /* { dg-final { scan-tree-dump-times "cold label heuristics" 1 "profile_estimate" } } */
-/* { dg-final { scan-tree-dump "A \\\[0\\\..*\\\]" "profile_estimate" } } */
+/* { dg-final { scan-tree-dump-times "combined heuristics: 0\\\..*" 1 "profile_estimate" } } */
 
 /* Note: we're attempting to match some number > 6000, i.e. > 60%.
    The exact number ought to be tweekable without having to juggle
    the testcase around too much.  */
-/* { dg-final { scan-tree-dump "B \\\[\[6-9\]\[0-9\]\\\..*\\\]" "profile_estimate" } } */
+/* { dg-final { scan-tree-dump-times "combined heuristics: \[6-9\]\[0-9\]\\\..*" 1 "profile_estimate" } } */