ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.19k stars 258 forks source link

FrontEnd PGO (FE PGO) vs IR PGO #4542

Open zamazan4ik opened 9 months ago

zamazan4ik commented 9 months ago

According to the LDC documentation, LDC now implements FrontEnd PGO (FE PGO) (since -fprofile-instr-generate option in Clang enables FE PGO too).

According to the issue in the LLVM tracker, FE PGO is not a recommended way to implement PGO nowadays. IR PGO (-fprofile-generate option in Clang) should be used instead.

I think we need to consider giving the possibility to users use IR PGO with LDC as well and write this recommendation in LDC's PGO documentation.

kinke commented 9 months ago

We do have IR-based PGO since a very long time; like clang, we use -fprofile-{use,generate} for that. It's also the PGO method we use for the compiler itself.

zamazan4ik commented 9 months ago

Great! That means the only needed change here is updating this PGO guide: https://wiki.dlang.org/LDC_LLVM_profiling_instrumentation :)