From d1b9a5724b8a05d2d2d51b3e5d13cc785326c74f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 19 Jan 2018 13:03:24 +0100 Subject: Fix usage of analyze_brprob.py script. 2018-01-19 Martin Liska * analyze_brprob.py: Support new format that can be easily parsed. Add new column to report. 2018-01-19 Martin Liska * 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 --- gcc/ChangeLog | 7 +++++++ gcc/predict.c | 13 +++++++++++++ gcc/profile-count.h | 5 +++++ 3 files changed, 25 insertions(+) (limited to 'gcc') 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 + + * 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 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. -- cgit v1.1