On Thu, Nov 21, 2024 at 1:32 PM Kamil Belter <kamil.bel...@gmail.com> wrote: > > On Tue, Nov 19, 2024 at 12:58 PM Richard Biener > <richard.guent...@gmail.com> wrote: > > > > 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. > > > How to reconstruct a profile? I think I haven't found it in the documentation.
There's some documentation in tree-profile.cc > > > 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. > > > Ok, thank you. Good to know this. > > > > 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. > > > Maybe I can try to add it just for my task. Could you at least point > me where I should look in gcc source code? Start at gcc/tree-profile.cc > > 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 > > Thank you for your answers. > Kamil