NixOS/nixpkgs

Build clang package with PGO

Closed this issue · 1 comments

Describe the bug

LLVM supports building Clang with PGO (https://llvm.org/docs/HowToBuildWithPGO.html). Using PGO for compilers has a huge impact on compiler performance. E.g. many distros are already building GCC (which also supports PGO builds) with PGO. I think for the users would be beneficial to have faster Clang binaries.

Locally I usually build my own Clang version. According to my tests, it could bring up to 20% performance.

Additionally, you could consider using LLVM BOLT as an additional optimization step, but I guess it should be discussed in another issue after the PGO implementation.

Expected behavior

clang package will be PGO-optimized.

Other notes

It's not actually a bug - just an improvement request. Feel free to assign to the more proper category.

FWIW, the community explicitly made the decision to turn off PGO in GCC in order to have proper reproducibility: #112928