<div dir="ltr">Hi,<div><br></div><div>It kind of depends on how you define what PGO consists of. But, let's not get stuck on terminology. Basically, if you provide profiling information, then LLVM will take</div><div>them into account by default. If not, yes, it will use static heuristics. However, that doesn't necessarily mean that it will _estimate frequencies_ because a lot of times the code looks like this:</div><div>if (there is profiling information) {</div><div>  use a heuristic which is based on frequencies</div><div>} else {</div><div>  use a heuristic based on other things (e.g., the structure of the code)</div><div>}</div><div><br></div><div>i.e., the else part is not necessarily "else estimate frequencies and use the same heuristic as if there were"</div><div><br></div><div>Best,</div><div>Stefanos</div><div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Στις Δευ, 28 Ιουν 2021 στις 4:30 π.μ., ο/η Reixiong Hu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> έγραψε:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="ZH-CN" style="overflow-wrap: break-word;"><div class="gmail-m_3738519491716336691WordSection1"><p class="MsoNormal"><span lang="EN-US">Hello, All,</span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">I am studying the optimizations adopted by LLVM, and finding PGO, which is said to be a good helper for optimization.</span></p><p class="MsoNormal"><span lang="EN-US">Since that requires to instrument and execute the object program, which may be costly for compilation and sometimes inconvenient for developers to come up with test cases, I wonder whether it is a default option for the compilation (i.e., when -O2 or -O3 is enabled)?</span></p><p class="MsoNormal"><span lang="EN-US">If that is the case, how LLVM generates test cases for the profiling if no tests are provided?</span></p><p class="MsoNormal"><span lang="EN-US">If PGO is default and there are no test cases, does LLVM estimate the profiling information, such as frequencies of bbs or calls, statically?</span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Thanks for your time.</span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Sincerely,</span></p><p class="MsoNormal"><span lang="EN-US">Reixiong Hu</span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>