summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-03-29 12:45:56 +0100
committerMartin Liska <marxin@gcc.gnu.org>2019-03-29 11:45:56 +0000
commitdd7fa0d4f34008a4b1f586ac36b9fd9c5bab92a1 (patch)
tree0555cdcf7b834760dd74e88cd3926c53b551c509
parent2a7108b96e7bd599971feeda4bc362b16ec19328 (diff)
Dump -fdbg-cnt limit reach also to stderr stream.
2019-03-29 Martin Liska <mliska@suse.cz> * dbgcnt.c (print_limit_reach): New function. (dbg_cnt): Use it. 2019-03-29 Martin Liska <mliska@suse.cz> * gcc.dg/ipa/ipa-icf-39.c: Prine '***dbgcnt' output. * gcc.dg/pr68766.c: Likewise. From-SVN: r270015
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/dbgcnt.c26
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-icf-39.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr68766.c1
5 files changed, 28 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7f6b8a5cd32..a941f2467be 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-03-29 Martin Liska <mliska@suse.cz>
+ * dbgcnt.c (print_limit_reach): New function.
+ (dbg_cnt): Use it.
+
+2019-03-29 Martin Liska <mliska@suse.cz>
+
* 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 e2f65f449e5..15ffe115a4f 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 07274c620c8..08d0609e2e0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-29 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/ipa/ipa-icf-39.c: Prine '***dbgcnt' output.
+ * gcc.dg/pr68766.c: Likewise.
+
2019-03-29 Jakub Jelinek <jakub@redhat.com>
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 18bd4b0e5be..a60721ffbd5 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 097e555eb01..5308b23d30b 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];