From f0dbeec7c506407aa7e02cc2df82057ea40ab457 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 28 Nov 2018 21:29:24 +0100 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/profile-count.h | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2e5d828e00..3c1f926e239 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-11-28 Jan Hubicka + + * profile-count.h (profile_count::split): Give better result when + splitting profile_probability::always. + 2018-11-28 Vladimir Makarov PR target/88207 diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 5d3bcc75f6d..620d6b71457 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; } -- 2.30.2