aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2016-08-09 22:57:14 +0200
committerMartin Liska <marxin@gcc.gnu.org>2016-08-09 20:57:14 +0000
commitdcb1e1379ea52c33e5025d6e5842c43888888afa (patch)
tree187f4b8334dcc9b7d561d703c32cb57e5646f3a5 /gcc
parent54b367dbd22e07e734a8632484e763bea16ced87 (diff)
downloadgcc-dcb1e1379ea52c33e5025d6e5842c43888888afa.zip
gcc-dcb1e1379ea52c33e5025d6e5842c43888888afa.tar.gz
gcc-dcb1e1379ea52c33e5025d6e5842c43888888afa.tar.bz2
Fix POW2 histogram
* gcc.dg/tree-prof/val-prof-8.c: New test. * value-prof.c (dump_histogram_value): Swap pow2 and non-pow2 values. * libgcov-profiler.c (__gcov_pow2_profiler): Consider 0 as not power of two. From-SVN: r239304
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/val-prof-8.c19
-rw-r--r--gcc/value-prof.c4
4 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 40537cb..dc14d6f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-09 Martin Liska <mliska@suse.cz>
+
+ * value-prof.c (dump_histogram_value): Swap pow2 and non-pow2
+ values.
+
2016-08-09 Renlin Li <renlin.li@arm.com>
PR middle-end/64971
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3483469..927f1e3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-08-09 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/tree-prof/val-prof-8.c: New test.
+
2016-08-09 Martin Jambor <mjambor@suse.cz>
PR ipa/71981
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-8.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-8.c
new file mode 100644
index 0000000..2c505e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-8.c
@@ -0,0 +1,19 @@
+/* { dg-options "-O0 -fdump-ipa-profile" } */
+
+int
+main (int argc, char **argv)
+{
+ unsigned u = (argc - 1);
+ int counter = 0;
+
+ for (unsigned i = 0; i < 100; i++)
+ {
+ unsigned x = i < 10 ? 16 : 15;
+ counter += u % x;
+ }
+
+ return counter;
+}
+
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Pow2 counter pow2:10 nonpow2:90." "profile" } } */
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 2976a86..0527c2c 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -264,8 +264,8 @@ dump_histogram_value (FILE *dump_file, histogram_value hist)
{
fprintf (dump_file, "pow2:%" PRId64
" nonpow2:%" PRId64,
- (int64_t) hist->hvalue.counters[0],
- (int64_t) hist->hvalue.counters[1]);
+ (int64_t) hist->hvalue.counters[1],
+ (int64_t) hist->hvalue.counters[0]);
}
fprintf (dump_file, ".\n");
break;