[llvm-dev] Questions about Profile Guided Optimization (PGO)

Stefanos Baziotis via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 27 19:32:14 PDT 2021


Hi,

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
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:
if (there is profiling information) {
  use a heuristic which is based on frequencies
} else {
  use a heuristic based on other things (e.g., the structure of the code)
}

i.e., the else part is not necessarily "else estimate frequencies and use
the same heuristic as if there were"

Best,
Stefanos

Στις Δευ, 28 Ιουν 2021 στις 4:30 π.μ., ο/η Reixiong Hu via llvm-dev <
llvm-dev at lists.llvm.org> έγραψε:

> Hello, All,
>
>
>
> I am studying the optimizations adopted by LLVM, and finding PGO, which is
> said to be a good helper for optimization.
>
> 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)?
>
> If that is the case, how LLVM generates test cases for the profiling if no
> tests are provided?
>
> If PGO is default and there are no test cases, does LLVM estimate the
> profiling information, such as frequencies of bbs or calls, statically?
>
>
>
> Thanks for your time.
>
>
>
> Sincerely,
>
> Reixiong Hu
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210628/bf9283e8/attachment.html>


More information about the llvm-dev mailing list