From: "Martin Liška" <mliska@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: GCC 9 backports
Date: Thu, 15 Oct 2020 11:07:47 +0200 [thread overview]
Message-ID: <ae0aed26-9df9-0c94-c732-100f39d95ad5@suse.cz> (raw)
In-Reply-To: <3411f3b2-0395-f09c-8804-ef2ff47e8254@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 190 bytes --]
On 10/2/20 1:15 PM, Martin Liška wrote:
> On 10/2/20 12:05 PM, Martin Liška wrote:
>> There are 2 more I've just tested.
>>
>> Martin
>
> and one more.
>
> Martin
and one more.
Martin
[-- Attachment #2: 0001-IPA-fix-profile-handling-in-IRA.patch --]
[-- Type: text/x-patch, Size: 1941 bytes --]
From 12c9413228d2955126ff5c45194f8aacf1aa81f6 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 13 Oct 2020 16:44:47 +0200
Subject: [PATCH] IPA: fix profile handling in IRA
gcc/ChangeLog:
PR ipa/97295
* profile-count.c (profile_count::to_frequency): Move part of
gcc_assert to STATIC_ASSERT.
* regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for
a function that does not have count_max initialized.
(cherry picked from commit 508e2d88a4c512e8b8685cf5ba201ad48e6bb58d)
---
gcc/profile-count.c | 4 ++--
gcc/regs.h | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gcc/profile-count.c b/gcc/profile-count.c
index 8c58f8666f0..8d3340041fc 100644
--- a/gcc/profile-count.c
+++ b/gcc/profile-count.c
@@ -262,8 +262,8 @@ profile_count::to_frequency (struct function *fun) const
return BB_FREQ_MAX;
if (*this == profile_count::zero ())
return 0;
- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX
- && fun->cfg->count_max.initialized_p ());
+ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX);
+ gcc_assert (fun->cfg->count_max.initialized_p ());
profile_probability prob = probability_in (fun->cfg->count_max);
if (!prob.initialized_p ())
return REG_BR_PROB_BASE;
diff --git a/gcc/regs.h b/gcc/regs.h
index 48b2e708160..2a19940281b 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -128,7 +128,8 @@ extern size_t reg_info_p_size;
or profile driven feedback is available and the function is never executed,
frequency is always equivalent. Otherwise rescale the basic block
frequency. */
-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \
+#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \
+ || !cfun->cfg->count_max.initialized_p ()) \
? REG_FREQ_MAX \
: ((bb)->count.to_frequency (cfun) \
* REG_FREQ_MAX / BB_FREQ_MAX) \
--
2.28.0
next prev parent reply other threads:[~2020-10-15 9:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 8:45 Martin Liška
2019-05-14 8:47 ` Martin Liška
2019-05-24 7:43 ` Martin Liška
2019-07-04 9:23 ` Martin Liška
2019-07-22 9:36 ` Martin Liška
2019-08-23 11:56 ` Martin Liška
2019-09-02 8:56 ` Martin Liška
2019-10-23 12:12 ` Martin Liška
2020-02-28 17:51 ` Martin Liška
2020-03-10 10:09 ` Martin Liška
2020-04-03 10:32 ` Martin Liška
2020-04-20 9:25 ` Martin Liška
2020-10-02 10:05 ` Martin Liška
2020-10-02 11:15 ` Martin Liška
2020-10-15 9:07 ` Martin Liška [this message]
2020-10-16 8:51 ` Martin Liška
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=ae0aed26-9df9-0c94-c732-100f39d95ad5@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@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).