* [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max
@ 2017-11-24 13:00 Siddhesh Poyarekar
2017-11-28 11:49 ` Siddhesh Poyarekar
0 siblings, 1 reply; 3+ messages in thread
From: Siddhesh Poyarekar @ 2017-11-24 13:00 UTC (permalink / raw)
To: gcc-patches; +Cc: hubicka
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max
2017-11-24 13:00 [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max Siddhesh Poyarekar
@ 2017-11-28 11:49 ` Siddhesh Poyarekar
2017-12-05 20:10 ` Jeff Law
0 siblings, 1 reply; 3+ messages in thread
From: Siddhesh Poyarekar @ 2017-11-28 11:49 UTC (permalink / raw)
To: gcc-patches; +Cc: hubicka
On Friday 24 November 2017 05:36 PM, Siddhesh Poyarekar wrote:
> 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.
Tests came out clean (no new regressions) on aarch64 and x86_64. Ping?
Siddhesh
>
> * 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;
> +}
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max
2017-11-28 11:49 ` Siddhesh Poyarekar
@ 2017-12-05 20:10 ` Jeff Law
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2017-12-05 20:10 UTC (permalink / raw)
To: Siddhesh Poyarekar, gcc-patches; +Cc: hubicka
On 11/28/2017 04:34 AM, Siddhesh Poyarekar wrote:
> On Friday 24 November 2017 05:36 PM, Siddhesh Poyarekar wrote:
>> 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.
>
> Tests came out clean (no new regressions) on aarch64 and x86_64. Ping?
>
> Siddhesh
>
>>
>> * gcc/predict.c (estimate_bb_frequencies): Don't reset freq_max.
>> * gcc/testsuite/gcc.dg/pr83069.c: New test case.
Just a note. Honza indicated in the associated BZ that he was going to
prepare an alternate patch to address this problem.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-05 20:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 13:00 [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max Siddhesh Poyarekar
2017-11-28 11:49 ` Siddhesh Poyarekar
2017-12-05 20:10 ` Jeff Law
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).