On Tue, Nov 19, 2024 at 11:56 AM Kamil Belter via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hello,
>
> I would like to set branch prediction based on .gcda files (I know I
> could have it automatically with -fprofile-use, but with my specific
> use case I can't do it).
>
> I've tried to use gcov-dump but I can't find any spec how to interpret
> this output.

The info doesn't represent a profile but just counter data - you have to
reconstruct a profile from that.

> I've also tried to use -fprofile-use with -fdump-rtl-all,
> -fdump-tree-all, -fdump-ipa-all, -fopt-info and
> -ftree-vectorizer-verbose=n flags and see GCC debug output

You probably want to restrict that to -fdump-ipa-profile which is the
point where the .gcda files are read and applied in a -fprofile-use
build.

> I got ~200
> new debug files per source file. I see that some of the files contain
> some format of source code. Some conditions are marked with percentage
> values, for example:
>
>   if (_11 != 0)
>     goto <bb 1>; [27.00%]
>   else
>     goto <bb 2>; [73.00%]
>
>   <bb 1> [local count: 51244186]:
>
> I'm guessing that this is prediction, but I found in doc that GCC uses
> its own heuristics for branch prediction. How to be sure if I'm
> looking at predictions from gcda files?

Internally we know which counts were based on feedback and which not
but I don't think we dump that info.

Richard.

> And side question what does
> "local count" mean? If this is relevant information I'm working with
> ARM.
>
> I would very appreciate your help with my questions.
>
> Best regards,
> Kamil Belter

Reply via email to