profile-count.h (profile_count::split): Give better result when splitting profile_pro...
authorJan Hubicka <jh@suse.cz>
Wed, 28 Nov 2018 20:29:24 +0000 (21:29 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 28 Nov 2018 20:29:24 +0000 (20:29 +0000)
* profile-count.h (profile_count::split): Give better result when
splitting profile_probability::always.

From-SVN: r266584

gcc/ChangeLog
gcc/profile-count.h

index f2e5d828e0034f469d9a3914f60d9cfda59bac98..3c1f926e239fc9532df83c72868afe3c74430cbb 100644 (file)
@@ -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
index 5d3bcc75f6d8374a28b9ca36410a7a890d8b30ff..620d6b7145790ee311dd90d0e0c97c8da92f4175 100644 (file)
@@ -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;
     }