aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-01-19 13:03:24 +0100
committerMartin Liska <marxin@gcc.gnu.org>2018-01-19 12:03:24 +0000
commitd1b9a5724b8a05d2d2d51b3e5d13cc785326c74f (patch)
treed863029ec8847f8c570a3e805a923100689efd40 /gcc
parent09a7858b2c53eccf28f780f5f3e4f2764f440eb1 (diff)
downloadgcc-d1b9a5724b8a05d2d2d51b3e5d13cc785326c74f.zip
gcc-d1b9a5724b8a05d2d2d51b3e5d13cc785326c74f.tar.gz
gcc-d1b9a5724b8a05d2d2d51b3e5d13cc785326c74f.tar.bz2
Fix usage of analyze_brprob.py script.
2018-01-19 Martin Liska <mliska@suse.cz> * analyze_brprob.py: Support new format that can be easily parsed. Add new column to report. 2018-01-19 Martin Liska <mliska@suse.cz> * predict.c (dump_prediction): Add new format for analyze_brprob.py script which is enabled with -details suboption. * profile-count.h (precise_p): New function. From-SVN: r256886
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/predict.c13
-rw-r--r--gcc/profile-count.h5
3 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c11f8c7..5ea286f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-19 Martin Liska <mliska@suse.cz>
+
+ * predict.c (dump_prediction): Add new format for
+ analyze_brprob.py script which is enabled with -details
+ suboption.
+ * profile-count.h (precise_p): New function.
+
2018-01-19 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/83922
diff --git a/gcc/predict.c b/gcc/predict.c
index 4c1e448..fdf5d82 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -747,6 +747,19 @@ dump_prediction (FILE *file, enum br_predictor predictor, int probability,
}
fprintf (file, "\n");
+
+ /* Print output that be easily read by analyze_brprob.py script. We are
+ interested only in counts that are read from GCDA files. */
+ if (dump_file && (dump_flags & TDF_DETAILS)
+ && bb->count.precise_p ()
+ && reason == REASON_NONE)
+ {
+ gcc_assert (e->count ().precise_p ());
+ fprintf (file, ";;heuristics;%s;%" PRId64 ";%" PRId64 ";%.1f;\n",
+ predictor_info[predictor].name,
+ bb->count.to_gcov_type (), e->count ().to_gcov_type (),
+ probability * 100.0 / REG_BR_PROB_BASE);
+ }
}
/* Return true if STMT is known to be unlikely executed. */
diff --git a/gcc/profile-count.h b/gcc/profile-count.h
index 7a43917..03e6635 100644
--- a/gcc/profile-count.h
+++ b/gcc/profile-count.h
@@ -691,6 +691,11 @@ public:
{
return !initialized_p () || m_quality >= profile_guessed_global0;
}
+ /* Return true if quality of profile is precise. */
+ bool precise_p () const
+ {
+ return m_quality == profile_precise;
+ }
/* When merging basic blocks, the two different profile counts are unified.
Return true if this can be done without losing info about profile.