From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: gcc-patches@gcc.gnu.org
Cc: hubicka@gcc.gnu.org
Subject: [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max
Date: Fri, 24 Nov 2017 13:00:00 -0000 [thread overview]
Message-ID: <1511525181-25726-1-git-send-email-siddhesh@gotplt.org> (raw)
freq_max < 1, i.e. highest frequency among bbs in the function being
higher than real_bb_freq_max means that the bb ends up with a profile
count larger than real_bb_freq_max and then can go all the way up to
and beyond profile_count::max_count.
Bootstrapped on aarch64, testsuite in progress.
* gcc/predict.c (estimate_bb_frequencies): Don't reset freq_max.
* gcc/testsuite/gcc.dg/pr83069.c: New test case.
---
gcc/predict.c | 2 --
gcc/testsuite/gcc.dg/pr83069.c | 15 +++++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr83069.c
diff --git a/gcc/predict.c b/gcc/predict.c
index 0f34956..ff9b5a9 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3613,8 +3613,6 @@ estimate_bb_frequencies (bool force)
freq_max = BLOCK_INFO (bb)->frequency;
freq_max = real_bb_freq_max / freq_max;
- if (freq_max < 16)
- freq_max = 16;
profile_count ipa_count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa ();
cfun->cfg->count_max = profile_count::uninitialized ();
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
diff --git a/gcc/testsuite/gcc.dg/pr83069.c b/gcc/testsuite/gcc.dg/pr83069.c
new file mode 100644
index 0000000..d43d78d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83069.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+void
+foo (unsigned long *res, unsigned long in)
+{
+ for (unsigned long a = 0; a < 98; a++)
+ for (unsigned long b = 0; b < 98; b++)
+ for (unsigned long c = 0; c < 98; c++)
+ for (unsigned long d = 0; d < 98; d++)
+ for (unsigned long e = 0; e < 98; e++)
+ for (unsigned long f = 0; f < 98; f++)
+ for (unsigned long g = 0; g < 98; g++)
+ *res += a * in;
+}
--
2.7.4
next reply other threads:[~2017-11-24 12:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 13:00 Siddhesh Poyarekar [this message]
2017-11-28 11:49 ` Siddhesh Poyarekar
2017-12-05 20:10 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1511525181-25726-1-git-send-email-siddhesh@gotplt.org \
--to=siddhesh@gotplt.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).