Bug 2224925

Summary: Build Clang with Profile-Guided Optimization (PGO)
Product: Red Hat Enterprise Linux 9 Reporter: Alexander Zaitsev <zamazan4ik>
Component: clangAssignee: Tom Stellard <tstellar>
Status: NEW --- QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, jchecahi, jwboyer, mprchlik, sipoyare
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexander Zaitsev 2023-07-24 00:18:31 UTC
Description of problem:

Clang supports (https://llvm.org/docs/HowToBuildWithPGO.html) bootstrapping with Profile-Guided Optimization (PGO). It increases Clang performance a lot (+20% according to the official docs and my own tests). The same thing is already enabled for GCC in Fedora (profiledbootstrap option). I think the same thing could be done for Clang since in the current build script I don't see that Clang is built with PGO.

Actual result:
Clang package is not PGO-optimized.

Expected results:
Provided Clang binaries with Fedora are built with PGO.

Additional option:
As an additional option, you could try to build binary with LLVM BOLT (https://github.com/facebookincubator/BOLT/blob/main/bolt/docs/OptimizingClang.md) but I guess it's another question and it's much more complicated topic.

More about PGO-related optimizations for other software you can find here: https://github.com/zamazan4ik/awesome-pgo

More about PGO optimizations for other LLVM-based projects (you can be interested in them too) you can find here: https://github.com/llvm/llvm-project/issues/63486

Also, I created a similar request in other Linux distributions:
- Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=2156679
- Rocky Linux: https://bugs.rockylinux.org/view.php?id=1618
- AlmaLinux: https://bugs.almalinux.org/view.php?id=350