aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile-count.h
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-11-29 11:29:44 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-29 10:29:44 +0000
commitdb51f624df2a965f70de70239c35e882b4897582 (patch)
tree25f8ed56b4c02634f18203902cde0e06f274974e /gcc/profile-count.h
parent60178a322b4e8d0dc6cf50f57f8fa1fdf624a1f0 (diff)
downloadgcc-db51f624df2a965f70de70239c35e882b4897582.zip
gcc-db51f624df2a965f70de70239c35e882b4897582.tar.gz
gcc-db51f624df2a965f70de70239c35e882b4897582.tar.bz2
profile-count.c (profile_count::to_cgraph_frequency, [...]): Check for compaibility of counts.
* profile-count.c (profile_count::to_cgraph_frequency, profile_count::to_sreal_scale): Check for compaibility of counts. * profile-count.h (compatible_p): Make public; add checking for global0 versus global types. * cgraph.c (cgraph_node::verify_node): Verify count compatibility. From-SVN: r278835
Diffstat (limited to 'gcc/profile-count.h')
-rw-r--r--gcc/profile-count.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/profile-count.h b/gcc/profile-count.h
index b79de83..5a5c046 100644
--- a/gcc/profile-count.h
+++ b/gcc/profile-count.h
@@ -700,6 +700,7 @@ private:
uint64_t UINT64_BIT_FIELD_ALIGN m_val : n_bits;
#undef UINT64_BIT_FIELD_ALIGN
enum profile_quality m_quality : 3;
+public:
/* Return true if both values can meaningfully appear in single function
body. We have either all counters in function local or global, otherwise
@@ -711,9 +712,18 @@ private:
if (*this == zero ()
|| other == zero ())
return true;
+ /* Do not allow nonzero global profile together with local guesses
+ that are globally0. */
+ if (ipa ().nonzero_p ()
+ && !(other.ipa () == other))
+ return false;
+ if (other.ipa ().nonzero_p ()
+ && !(ipa () == *this))
+ return false;
+
return ipa_p () == other.ipa_p ();
}
-public:
+
/* Used for counters which are expected to be never executed. */
static profile_count zero ()
{