aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile-count.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-12-08 12:27:28 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2017-12-08 11:27:28 +0000
commitf6422f23bba3ef7a6ed0fcf9525ad7c92d1905aa (patch)
tree04b3b1dbe61a5e583aa434041886ebd77afd6abd /gcc/profile-count.c
parentb1cf82933e894cbdb21d63653c20258dc8c87997 (diff)
downloadgcc-f6422f23bba3ef7a6ed0fcf9525ad7c92d1905aa.zip
gcc-f6422f23bba3ef7a6ed0fcf9525ad7c92d1905aa.tar.gz
gcc-f6422f23bba3ef7a6ed0fcf9525ad7c92d1905aa.tar.bz2
re PR tree-optimization/83609 (ICE in read_complex_part at gcc/expr.c:3202)
* profile-count.c (profile_count::from_gcov_type): Move from profile-count.h; handle overflow. * profile-count. (profile_count::from_gcov_type): Move offline. PR middle-end/83609 * gcc.c-torture/compile/pr83069.c: New testcase. From-SVN: r255507
Diffstat (limited to 'gcc/profile-count.c')
-rw-r--r--gcc/profile-count.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/profile-count.c b/gcc/profile-count.c
index 5d8e9c5..3b106d3f 100644
--- a/gcc/profile-count.c
+++ b/gcc/profile-count.c
@@ -327,3 +327,21 @@ profile_count::combine_with_ipa_count (profile_count ipa)
return this->global0 ();
return this->global0adjusted ();
}
+
+/* The profiling runtime uses gcov_type, which is usually 64bit integer.
+ Conversions back and forth are used to read the coverage and get it
+ into internal representation. */
+profile_count
+profile_count::from_gcov_type (gcov_type v)
+ {
+ profile_count ret;
+ gcc_checking_assert (v >= 0);
+ if (dump_file && v >= (gcov_type)max_count)
+ fprintf (dump_file,
+ "Capping gcov count %" PRId64 " to max_count %" PRId64 "\n",
+ (int64_t) v, (int64_t) max_count);
+ ret.m_val = MIN (v, (gcov_type)max_count);
+ ret.m_quality = profile_precise;
+ return ret;
+ }
+