paperbot · PL 论文追踪

全部论文 待读 收藏

P2 The road not taken: exploring alias analysis based optimizations missed by the compiler

未选择的路:探索被编译器错过的基于别名分析的优化
OOPSLA 6(OOPSLA2)2022匹配度 4/10 · 论文聚焦传统编译器的别名分析与运行时指针消歧,属于静态分析/编译器优化领域,但未涉及用户核心关注的 LLM/Agent 与静态分析交叉、浮点程序分析或贝叶斯程序分析,因此与研究方向匹配度较低。引用 12 inbox
Khushboo Chitre, Piyus Kedia, Rahul Purandare
crossref: 2026-09-10

AI 速览

一句话:提出 Scout,通过约束分配大小与对齐实现单次内存访问的运行时指针消歧,解锁被编译器错过的循环优化。

上下文敏感的过程间别名分析更精确但难以扩展,因此生产编译器常采用过程内别名分析,牺牲精度并损害循环优化。已有动态检查方案开销为 O(log n) 或仅适用于受限循环。本文提出 Scout,通过在内存分配时约束分配大小与对齐,实现用单次内存访问在运行时消歧两个指针,并能处理现有 O(1) 范围检查无法覆盖的循环内数组访问。Scout 还利用静态优化反馈减少动态检查数量。该技术为循环不变量代码外提、死存储消除、循环向量化和加载消除创造机会。评估显示,在已优化代码上 Polybench 提升最高 51.11%,CPU SPEC 2017 最高 0.89%;分配器 CPU/内存开销几何平均分别为 1.05%/7.47% 和 0.21%/0.13%。

问题
生产编译器为可扩展性牺牲别名分析精度,导致循环优化机会丢失;现有运行时消歧方案要么开销高,要么仅适用于受限循环。
方法
提出 Scout,通过约束内存分配的大小与对齐,用单次内存访问在运行时消歧指针和数组访问,并利用静态优化反馈减少动态检查数量。
评估
在 Polybench 和 CPU SPEC 2017 上评估优化收益及分配器 CPU/内存开销,Polybench 性能提升最高 51.11%,SPEC 最高 0.89%,开销较低。
原文摘要(Abstract)

Context-sensitive inter-procedural alias analyses are more precise than intra-procedural alias analyses. However, context-sensitive inter-procedural alias analyses are not scalable. As a consequence, most of the production compilers sacrifice precision for scalability and implement intra-procedural alias analysis. The alias analysis is used by many compiler optimizations, including loop transformations. Due to the imprecision of alias analysis, the program’s performance may suffer, especially in the presence of loops. Previous work proposed a general approach based on code-versioning with dynamic checks to disambiguate pointers at runtime. However, the overhead of dynamic checks in this approach is O(log n), which is substantially high to enable interesting optimizations. Other suggested approaches, e.g., polyhedral and symbolic range analysis, have O(1) overheads, but they only work for loops with certain constraints. The production compilers, such as LLVM and GCC, use scalar evolution analysis to compute an O(1) range check for loops to resolve memory dependencies at runtime. However, this approach also can only be applied to loops with certain constraints. In this work, we present our tool, Scout, that can disambiguate two pointers at runtime using single memory access. Scout is based on the key idea to constrain the allocation size and alignment during memory allocations. Scout can also disambiguate array accesses within a loop for which the existing O(1) range checks technique cannot be applied. In addition, Scout uses feedback from static optimizations to reduce the number of dynamic checks needed for optimizations. Our technique enabled new opportunities for loop-invariant code motion, dead store elimination, loop vectorization, and load elimination in an already optimized code. Our performance improvements are up to 51.11% for Polybench and up to 0.89% for CPU SPEC 2017 suites. The geometric means for our allocator’s CPU and memory overheads for CPU SPEC 2017 benchmarks are 1.05%, and 7.47%, respectively. For Polybench benchmarks, the geometric mean of CPU and memory overheads are 0.21% and 0.13%, respectively.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1455,
  title = {The road not taken: exploring alias analysis based optimizations missed by the compiler},
  author = {Khushboo Chitre and Piyus Kedia and Rahul Purandare},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA2},
  year = {2022},
  doi = {10.1145/3563316}
}