public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Jan Hubicka <hubicka@ucw.cz>
Subject: [PATCH] Calculate scaled frequency in HOST_WIDE_INT (PR ipa/80663).
Date: Thu, 18 May 2017 14:45:00 -0000	[thread overview]
Message-ID: <619f46a0-a592-0463-45a3-f95c6a1845be@suse.cz> (raw)

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

Hello.

Following simple fix removes ubsan in ipa-split.c as mentioned in the PR.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0001-Calculate-scaled-frequency-in-HOST_WIDE_INT-PR-ipa-8.patch --]
[-- Type: text/x-patch, Size: 1864 bytes --]

From f6230b40aa6f9d5a67e6231de2a26bc488dc784d Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 17 May 2017 13:23:54 +0200
Subject: [PATCH] Calculate scaled frequency in HOST_WIDE_INT (PR ipa/80663).

gcc/testsuite/ChangeLog:

2017-05-17  Martin Liska  <mliska@suse.cz>

	PR ipa/80663
	* g++.dg/ipa/pr80663.C: New test.

gcc/ChangeLog:

2017-05-17  Martin Liska  <mliska@suse.cz>

	PR ipa/80663
	* ipa-split.c (consider_split): Calculate scaled frequency
	in HOST_WIDE_INT.
---
 gcc/ipa-split.c                    |  7 ++++---
 gcc/testsuite/g++.dg/ipa/pr80663.C | 10 ++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/ipa/pr80663.C

diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 80fc31b52f8..9d00849a9fa 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -443,9 +443,10 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
     }
 
   /* Do not split when we would end up calling function anyway.  */
-  if (incoming_freq
-      >= (ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency
-	  * PARAM_VALUE (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY) / 100))
+  HOST_WIDE_INT scaled_frequency
+    = ((HOST_WIDE_INT)ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency
+       * PARAM_VALUE (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY) / 100);
+  if (incoming_freq >= scaled_frequency)
     {
       /* When profile is guessed, we can not expect it to give us
 	 realistic estimate on likelyness of function taking the
diff --git a/gcc/testsuite/g++.dg/ipa/pr80663.C b/gcc/testsuite/g++.dg/ipa/pr80663.C
new file mode 100644
index 00000000000..8a5d84bbc05
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr80663.C
@@ -0,0 +1,10 @@
+// PR ipa/80663
+// { dg-options "-O2 --param partial-inlining-entry-probability=1234567" }
+
+struct b
+{
+};
+struct d : virtual b
+{
+};
+main () { d a; }
-- 
2.12.2


                 reply	other threads:[~2017-05-18 14:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=619f46a0-a592-0463-45a3-f95c6a1845be@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /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).