一句话:提出递归比较代码区域 opcode 直方图的轻量方法,在优化流水线中自动传播 profile 信息,比 LLM 与 LLVM/BOLT 方法更准确。
Profile-guided optimization(PGO)利用程序执行信息指导内联、代码布局等优化,但优化变换会改变控制流,使收集到的 profile 过期或不准确。本文研究在不重新执行程序的前提下复用 profile 数据,考察两种互补策略:prediction 预测优化后程序中的热路径,projection 将 profile 信息从原始控制流图迁移到变换后的控制流图。作者评估了多种 profile 重建技术,包括基于 GPT-4o 的大语言模型方法与递归比较代码区域 opcode 直方图的轻量方法。结果表明,基于直方图的方法不仅更简单,而且始终比 LLM 方法以及 LLVM、BOLT 中已有的 prediction 与 projection 技术更准确。
Profile-guided optimization (PGO) is a well-established technique for improving program performance, being integrated into major compilers such as GCC, LLVM/Clang, and Microsoft Visual C++. PGO collects information about a program’s execution and uses it to guide optimizations such as inlining, and code layout. However, these very transformations alter the program’s control flow, rendering the collected profiles stale or inaccurate. To deal with this problem, this paper investigates how to reuse profile data after optimization without re-executing the program. We study two complementary strategies: prediction, which estimates likely hot code paths in the optimized program, and projection, which transfers profile information from the original control-flow graph to its transformed version. We evaluate several techniques for reconstructing profile data, including a large language model (LLM)–based approach using GPT-4o, and a lightweight method that compares opcode histograms of code regions recursively to identify structural similarities. Our results show that the histogram-based method is not only simpler but also consistently more accurate than both the LLM-based approach and prior prediction and projection techniques, including those implemented in LLVM and the BOLT binary optimizer.
@article{paperbot3825,
title = {Automatic Propagation of Profile Information through the Optimization Pipeline},
author = {Elisa Fröhlich and Angélica Moreira and Fernando Magno Quintão Pereira},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {OOPSLA1},
year = {2026},
doi = {10.1145/3798247}
}