Data center applications are generally very large and complex, which makes code layout an important optimization to improve their performance. Such a technique for code layout is called feedback-driven optimizations (FDO) or profile-guided optimizations (PGO). However, due to their large sizes, applying FDO to these applications leads to scalability issues due to significant memory and computation usage and cost, which makes this technique practically impossible.
However, https://github.com/llvm/llvm-project/tree/main/bolt demonstrates that the post-link optimizations are still useful because injecting the profile data later enables more accurate use of the information for better code layout, and mapping the profile data, which is collected at the binary level, back to the binary level (instead of the compiler’s intermediate representation) is much simpler, resulting in efficient low-level optimizations such as code layout.
A. First, profiling data typically collects binary-level events, and there are challenges in mapping such events to higher-level code representation.