aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2018-11-28 21:29:24 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2018-11-28 20:29:24 +0000
commitf0dbeec7c506407aa7e02cc2df82057ea40ab457 (patch)
tree6bd0c62d4400b9b5e93c8f76b7bfbcaac3a7b2fb
parentc3cc0122ca3f2a1d039dd24e1590362302de30b6 (diff)
downloadgcc-f0dbeec7c506407aa7e02cc2df82057ea40ab457.zip
gcc-f0dbeec7c506407aa7e02cc2df82057ea40ab457.tar.gz
gcc-f0dbeec7c506407aa7e02cc2df82057ea40ab457.tar.bz2
profile-count.h (profile_count::split): Give better result when splitting profile_probability::always.
* profile-count.h (profile_count::split): Give better result when splitting profile_probability::always. From-SVN: r266584
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/profile-count.h8
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f2e5d82..3c1f926 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-28 Jan Hubicka <jh@suse.cz>
+
+ * profile-count.h (profile_count::split): Give better result when
+ splitting profile_probability::always.
+
2018-11-28 Vladimir Makarov <vmakarov@redhat.com>
PR target/88207
diff --git a/gcc/profile-count.h b/gcc/profile-count.h
index 5d3bcc7..620d6b7 100644
--- a/gcc/profile-count.h
+++ b/gcc/profile-count.h
@@ -447,8 +447,12 @@ public:
{
profile_probability ret = *this * cprob;
/* The following is equivalent to:
- *this = cprob.invert () * *this / ret.invert (); */
- *this = (*this - ret) / ret.invert ();
+ *this = cprob.invert () * *this / ret.invert ();
+ Avoid scaling when overall outcome is supposed to be always.
+ Without knowing that one is inverse of toher, the result would be
+ conservative. */
+ if (!(*this == profile_probability::always ()))
+ *this = (*this - ret) / ret.invert ();
return ret;
}