Modern compilers optimize programs through a sequence of modular passes over intermediate representations (IR). While this pass-by-pass paradigm offers engineering benefits, it suffers from a pass coordination problem: locally beneficial transformations may block more profitable optimizations in later stages. This limitation stems from the lack of an explicit notion of optimization intent, defined as a holistic strategy for coordinating multiple transformations toward a global performance objective. Recent LLM-based approaches formulate IR optimization as an end-to-end generation task, thereby avoiding the traditional pass-by-pass structure. However, optimization intent remains implicit in these methods, forcing models to jointly infer optimization strategy and generate low-level transformations, which limits both correctness and performance. We propose IntOpt, the first intent-driven IR optimizer that explicitly separates high-level optimization intent from low-level analysis and transformation. IntOpt organizes IR optimization into three stages: intent formulation, intent refinement, and intent realization, enabling globally coordinated transformations. Experiments show that IntOpt achieves 90.5% verified correctness and 2.660x average speedup on 200-program test set, outperforming state-of-the-art LLM-based optimizers in both correctness and performance, and surpassing modern compiler with the -O3 option on 37 benchmarks with speedups of up to 272.60x.
翻译:现代编译器通过一系列模块化的中间表示(IR)遍处理来优化程序。尽管这种逐遍范式具有工程上的优势,但它存在一个遍协调问题:局部有益的转换可能会阻碍后续阶段更具效益的优化。这一局限性源于缺乏明确的优化意图概念,即一种协调多个转换以实现全局性能目标的整体策略。近期基于大语言模型(LLM)的方法将IR优化表述为一个端到端的生成任务,从而避免了传统的逐遍结构。然而,在这些方法中,优化意图仍然是隐式的,迫使模型同时推断优化策略并生成低层转换,这限制了正确性和性能。我们提出了IntOpt,第一个意图驱动的IR优化器,它明确地将高层优化意图与低层分析和转换分离开来。IntOpt将IR优化组织为三个阶段:意图制定、意图精化和意图实现,从而实现全局协调的转换。实验表明,IntOpt在200个程序的测试集上实现了90.5%的已验证正确性和2.660倍的平均加速比,在正确性和性能上均优于最先进的基于LLM的优化器,并在37个基准测试中超越了使用-O3选项的现代编译器,加速比最高可达272.60倍。