aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-11-28 17:58:24 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-28 16:58:24 +0000
commit97dd1ee8de2ceb45b1572964bc2849d32cb2b322 (patch)
tree18d1ab815021837250a9450212e597225f7949dd /gcc
parent2dfd63ded836e993c3693da957142b0228c61607 (diff)
downloadgcc-97dd1ee8de2ceb45b1572964bc2849d32cb2b322.zip
gcc-97dd1ee8de2ceb45b1572964bc2849d32cb2b322.tar.gz
gcc-97dd1ee8de2ceb45b1572964bc2849d32cb2b322.tar.bz2
profile-count.h (profile_count::max): Work on profiles of different type.
* profile-count.h (profile_count::max): Work on profiles of different type. (profile_count::apply_scale): Be sure that ret is not local or global0 type if num is global. From-SVN: r278813
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/profile-count.h19
2 files changed, 29 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6086353..e842cd2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2019-11-28 Jan Hubicka <hubicka@ucw.cz>
+
+ * profile-count.h (profile_count::max): Work on profiles of different
+ type.
+ (profile_count::apply_scale): Be sure that ret is not local or global0
+ type if num is global.
+
+2019-11-28 Jan Hubicka <hubicka@ucw.cz>
+
+ * profile-count.h (profile_count::max): Work on profiles of different
+ type.
+ (profile_count::apply_scale): Be sure that ret is not local or global0
+ type if num is global.
+
2019-11-28 Martin Jambor <mjambor@suse.cz>
PR ipa/92697
diff --git a/gcc/profile-count.h b/gcc/profile-count.h
index 967c5ec..b79de83 100644
--- a/gcc/profile-count.h
+++ b/gcc/profile-count.h
@@ -992,6 +992,14 @@ public:
profile_count max (profile_count other) const
{
+ profile_count val = *this;
+
+ /* Always prefer nonzero IPA counts over local counts. */
+ if (ipa ().nonzero_p () || other.ipa ().nonzero_p ())
+ {
+ val = ipa ();
+ other = other.ipa ();
+ }
if (!initialized_p ())
return other;
if (!other.initialized_p ())
@@ -1001,8 +1009,8 @@ public:
if (other == zero ())
return *this;
gcc_checking_assert (compatible_p (other));
- if (m_val < other.m_val || (m_val == other.m_val
- && m_quality < other.m_quality))
+ if (val.m_val < other.m_val || (m_val == other.m_val
+ && val.m_quality < other.m_quality))
return other;
return *this;
}
@@ -1075,8 +1083,11 @@ public:
ret.m_val = MIN (val, max_count);
ret.m_quality = MIN (MIN (MIN (m_quality, ADJUSTED),
num.m_quality), den.m_quality);
- if (num.ipa_p () && !ret.ipa_p ())
- ret.m_quality = MIN (num.m_quality, GUESSED);
+ /* Be sure that ret is not local if num is global.
+ Also ensure that ret is not global0 when num is global. */
+ if (num.ipa_p ())
+ ret.m_quality = MAX (ret.m_quality,
+ num == num.ipa () ? GUESSED : num.m_quality);
return ret;
}