From: Martin Liska Date: Fri, 29 Mar 2019 11:45:56 +0000 (+0100) Subject: Dump -fdbg-cnt limit reach also to stderr stream. X-Git-Tag: upstream/12.2.0~25434 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd7fa0d4f34008a4b1f586ac36b9fd9c5bab92a1;p=platform%2Fupstream%2Fgcc.git Dump -fdbg-cnt limit reach also to stderr stream. 2019-03-29 Martin Liska * dbgcnt.c (print_limit_reach): New function. (dbg_cnt): Use it. 2019-03-29 Martin Liska * gcc.dg/ipa/ipa-icf-39.c: Prine '***dbgcnt' output. * gcc.dg/pr68766.c: Likewise. From-SVN: r270015 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7f6b8a5..a941f24 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2019-03-29 Martin Liska + * dbgcnt.c (print_limit_reach): New function. + (dbg_cnt): Use it. + +2019-03-29 Martin Liska + * dbgcnt.c (dbg_cnt_process_single_pair): Fix GNU coding style. (dbg_cnt_process_opt): Parse first tokens aas dbg_cnt_process_single_pair is also using strtok. diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c index e2f65f4..15ffe11 100644 --- a/gcc/dbgcnt.c +++ b/gcc/dbgcnt.c @@ -58,21 +58,27 @@ dbg_cnt_is_enabled (enum debug_counter index) return v > limit_low[index] && v <= limit_high[index]; } +static void +print_limit_reach (const char *counter, int limit, bool upper_p) +{ + char buffer[128]; + sprintf (buffer, "***dbgcnt: %s limit %d reached for %s.***\n", + upper_p ? "upper" : "lower", limit, counter); + fputs (buffer, stderr); + if (dump_file) + fputs (buffer, dump_file); +} + bool dbg_cnt (enum debug_counter index) { count[index]++; - if (dump_file) - { - /* Do not print the info for default lower limit. */ - if (count[index] == limit_low[index] && limit_low[index] > 0) - fprintf (dump_file, "***dbgcnt: lower limit %d reached for %s.***\n", - limit_low[index], map[index].name); - else if (count[index] == limit_high[index]) - fprintf (dump_file, "***dbgcnt: upper limit %d reached for %s.***\n", - limit_high[index], map[index].name); - } + /* Do not print the info for default lower limit. */ + if (count[index] == limit_low[index] && limit_low[index] > 0) + print_limit_reach (map[index].name, limit_low[index], false); + else if (count[index] == limit_high[index]) + print_limit_reach (map[index].name, limit_high[index], true); return dbg_cnt_is_enabled (index); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 07274c62..08d0609 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-29 Martin Liska + + * gcc.dg/ipa/ipa-icf-39.c: Prine '***dbgcnt' output. + * gcc.dg/pr68766.c: Likewise. + 2019-03-29 Jakub Jelinek PR rtl-optimization/87485 diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-icf-39.c b/gcc/testsuite/gcc.dg/ipa/ipa-icf-39.c index 18bd4b0..a60721f 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-icf-39.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-icf-39.c @@ -2,6 +2,7 @@ /* { dg-require-alias "" } */ /* { dg-options "-O2 -fdump-ipa-icf -fmerge-all-constants -fdbg-cnt=merged_ipa_icf:1:3" } */ /* { dg-prune-output "dbg_cnt 'merged_ipa_icf' set to 1-3" } */ +/* { dg-prune-output "\\*\\*\\*dbgcnt:.*limit.*reached" } */ static int a; static int b; diff --git a/gcc/testsuite/gcc.dg/pr68766.c b/gcc/testsuite/gcc.dg/pr68766.c index 097e555..5308b23 100644 --- a/gcc/testsuite/gcc.dg/pr68766.c +++ b/gcc/testsuite/gcc.dg/pr68766.c @@ -2,6 +2,7 @@ /* { dg-options "-O2 -ftree-vectorize -fdbg-cnt=vect_loop:1" } */ /* { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-prune-output "dbg_cnt 'vect_loop' set to 0-1" } */ +/* { dg-prune-output "\\*\\*\\*dbgcnt:.*limit.*reached" } */ int a, b, g, h; int c[58];