diff mbox

Don't dump bb details when removing a block

Message ID CAAe5K+WYp_aMfUqQC3W8prxH9_YoOCbSgWztGKZ9TidfOq5AKg@mail.gmail.com
State New
Headers show

Commit Message

Teresa Johnson April 8, 2014, 4:55 p.m. UTC
This patch removes the printing of details for BBs that are being removed.

When printing bb details, dump_bb_info will invoke check_bb_profile, which will
flag spurious profile insanities in the removed bb since the incoming edges
have already been removed. This makes it harder to identify true profile
insanities in dumps, both for the gcc testsuite and in my own testing when I
have been trying to identify and fix profile insanities introduced by
optimization.

The other effects of removing the details printing is that the profile counts
on the bb being removed, as well as its prev and next blocks, are suppressed,
which doesn't strike me as a problem. In fact, one of the tests needed its
expected dump output adjusted from my change, and in looking at that I
discovered that the profile count it was scanning for was matching that of a
removed block after a recent change (r208165), instead of a block in the
optimized code.

Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for either trunk or
stage 1?

Thanks,
Teresa

2014-04-08  Teresa Johnson  <tejohnson@google.com>

        * tree-cfg.c (remove_bb): Don't dump details during bb removal.

2014-04-08  Teresa Johnson  <tejohnson@google.com>

        * gcc.dg/tree-prof/update-loopch.c: Update expected output.

"optimized"} } */
+/* { dg-final-use { scan-tree-dump "Removing basic block" "optimized"} } */
+/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
 /* { dg-final-use { cleanup-ipa-dump "profile" } } */
 /* { dg-final-use { cleanup-tree-dump "optimized" } } */

Comments

Richard Biener April 11, 2014, 8:14 a.m. UTC | #1
On Tue, Apr 8, 2014 at 6:55 PM, Teresa Johnson <tejohnson@google.com> wrote:
> This patch removes the printing of details for BBs that are being removed.
>
> When printing bb details, dump_bb_info will invoke check_bb_profile, which will
> flag spurious profile insanities in the removed bb since the incoming edges
> have already been removed. This makes it harder to identify true profile
> insanities in dumps, both for the gcc testsuite and in my own testing when I
> have been trying to identify and fix profile insanities introduced by
> optimization.
>
> The other effects of removing the details printing is that the profile counts
> on the bb being removed, as well as its prev and next blocks, are suppressed,
> which doesn't strike me as a problem. In fact, one of the tests needed its
> expected dump output adjusted from my change, and in looking at that I
> discovered that the profile count it was scanning for was matching that of a
> removed block after a recent change (r208165), instead of a block in the
> optimized code.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for either trunk or
> stage 1?

IMHO it's odd to strip just a single flag - I'd go for specifying the desired
flags explicitely, like dumping with TDF_BLOCKS only (dumping edges
is certainly useful IMHO).  Or dump with 0.

Either way ok for stage1.

Thanks,
Richard.

> Thanks,
> Teresa
>
> 2014-04-08  Teresa Johnson  <tejohnson@google.com>
>
>         * tree-cfg.c (remove_bb): Don't dump details during bb removal.
>
> 2014-04-08  Teresa Johnson  <tejohnson@google.com>
>
>         * gcc.dg/tree-prof/update-loopch.c: Update expected output.
>
> Index: tree-cfg.c
> ===================================================================
> --- tree-cfg.c  (revision 208492)
> +++ tree-cfg.c  (working copy)
> @@ -1947,7 +1947,7 @@ remove_bb (basic_block bb)
>        fprintf (dump_file, "Removing basic block %d\n", bb->index);
>        if (dump_flags & TDF_DETAILS)
>         {
> -         dump_bb (dump_file, bb, 0, dump_flags);
> +         dump_bb (dump_file, bb, 0, dump_flags && ~TDF_DETAILS);
>           fprintf (dump_file, "\n");
>         }
>      }
> Index: testsuite/gcc.dg/tree-prof/update-loopch.c
> ===================================================================
> --- testsuite/gcc.dg/tree-prof/update-loopch.c  (revision 208492)
> +++ testsuite/gcc.dg/tree-prof/update-loopch.c  (working copy)
> @@ -15,8 +15,9 @@ main ()
>     is once reached directly from entry point of function, rest via loopback
>     edge.  */
>  /* { dg-final-use { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */
> -/* { dg-final-use { scan-tree-dump "loop depth 1, count 33332"
> "optimized"} } */
> -/* { dg-final-use { scan-tree-dump-times "Removing basic block
> \[^\r\n\]*\[\\r\\n\]+\[^\r\n\]*\[\\r\\n\]+Invalid sum
> of\[^\r\n\]*\[\\r\\n\]+Invalid sum of" 1 "optimized"} } */
> -/* { dg-final-use { scan-tree-dump-times "Invalid sum of" 2 "optimized"} } */
> +/* { dg-final-use { scan-tree-dump "loop depth 1, count 33333"
> "optimized"} } */
> +/* { dg-final-use { scan-tree-dump-not "loop depth 1, count 33332"
> "optimized"} } */
> +/* { dg-final-use { scan-tree-dump "Removing basic block" "optimized"} } */
> +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
>  /* { dg-final-use { cleanup-ipa-dump "profile" } } */
>  /* { dg-final-use { cleanup-tree-dump "optimized" } } */
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
diff mbox

Patch

Index: tree-cfg.c
===================================================================
--- tree-cfg.c  (revision 208492)
+++ tree-cfg.c  (working copy)
@@ -1947,7 +1947,7 @@  remove_bb (basic_block bb)
       fprintf (dump_file, "Removing basic block %d\n", bb->index);
       if (dump_flags & TDF_DETAILS)
        {
-         dump_bb (dump_file, bb, 0, dump_flags);
+         dump_bb (dump_file, bb, 0, dump_flags && ~TDF_DETAILS);
          fprintf (dump_file, "\n");
        }
     }
Index: testsuite/gcc.dg/tree-prof/update-loopch.c
===================================================================
--- testsuite/gcc.dg/tree-prof/update-loopch.c  (revision 208492)
+++ testsuite/gcc.dg/tree-prof/update-loopch.c  (working copy)
@@ -15,8 +15,9 @@  main ()
    is once reached directly from entry point of function, rest via loopback
    edge.  */
 /* { dg-final-use { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */
-/* { dg-final-use { scan-tree-dump "loop depth 1, count 33332"
"optimized"} } */
-/* { dg-final-use { scan-tree-dump-times "Removing basic block
\[^\r\n\]*\[\\r\\n\]+\[^\r\n\]*\[\\r\\n\]+Invalid sum
of\[^\r\n\]*\[\\r\\n\]+Invalid sum of" 1 "optimized"} } */
-/* { dg-final-use { scan-tree-dump-times "Invalid sum of" 2 "optimized"} } */
+/* { dg-final-use { scan-tree-dump "loop depth 1, count 33333"
"optimized"} } */
+/* { dg-final-use { scan-tree-dump-not "loop depth 1, count 33332"