* [PATCH] Calculate scaled frequency in HOST_WIDE_INT (PR ipa/80663).
@ 2017-05-18 14:45 Martin Liška
0 siblings, 0 replies; only message in thread
From: Martin Liška @ 2017-05-18 14:45 UTC (permalink / raw)
To: GCC Patches; +Cc: Jan Hubicka
[-- 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-05-18 14:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 14:45 [PATCH] Calculate scaled frequency in HOST_WIDE_INT (PR ipa/80663) Martin Liška
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).