This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Profile-guided optimization
Juan Antonio Farré Basurte wrote:
> I want to use profile-guided optimization in my current development project. I have a doubt for which I can't find an answer
> anywhere.
>
> The basic idea of PGO is:
> 1. Build instrumented code
> 2. Run real-world representative tests to generate profile
> info.
> 3. Build code using profile info for optimizations.
>
> My doubt is whether I should build instrumented code (step 1) already
> with the same optimization options I want to finally use in step 3, or I'd get more realistical profile info if I compile step 1 without any
> optimization (or may be some intermediate option).
>
> Does anybody have any hints about this question?
It's an interative process. You start with compiling your code with a
best guess set of optimization options and then rebuild with PGO, and
then profile again. Measure every time, make sure you're getting an
improvement.
Andrew.