arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2603.09726cs.PL
收藏

幂等切片及其在代码大小缩减中的应用

Idempotent Slices with Applications to Code-Size Reduction

UFMG(米纳斯吉拉斯联邦大学);Huawei(华为)

Rafael Alvarenga de Azevedo, Daniel Augusto Costa de Sa, Rodrigo Caetano Rocha, Fernando Magno Quintão Pereira

AI总结:

本文提出一种高效的幂等后向切片算法,用于实现代码大小缩减优化,通过提取切片实现非连续指令序列的合并。

摘要:

给定一个在程序中计算出的值,一个相对于该值的幂等后向切片是计算它的最大子程序。Guimaraes等人之前曾 informal 地使用幂等切片的概念将 eager 评估转换为 strict 评估,在 LLVM 中间表示中。然而,该算法不足以正确应用于一般的控制流图。本文通过形式化幂等后向切片的概念,并提出一种 sound 且高效的算法来从 Gated Static Single Assignment (GSA) 形式中的程序中提取它们。作为其实际应用的示例,本文描述了如何通过识别和提取幂等后向切片来实现稀疏代码大小缩减优化;即,一种能够合并非连续指令序列在单个函数或跨函数的控制流图中的优化。对 LLVM 测试套件的实验表明,在特定基准中,该新算法在经过 clang 17 的 -Os 序列处理的程序中,实现了高达 -7.24% 的代码大小缩减。

英文摘要:

Given a value computed within a program, an idempotent backward slice with respect to this value is a maximal subprogram that computes it. An informal notion of an idempotent slice has previously been used by Guimaraes et al. to transform eager into strict evaluation in the LLVM intermediate representation. However, that algorithm is insufficient to be correctly applied to general control-flow graphs. This paper addresses these omissions by formalizing the notion of idempotent backward slices and presenting a sound and efficient algorithm for extracting them from programs in Gated Static Single Assignment (GSA) form. As an example of their practical use, the paper describes how identifying and extracting idempotent backward slices enables a sparse code-size reduction optimization; that is, one capable of merging non-contiguous sequences of instructions within the control-flow graph of a single function or across functions. Experiments with the LLVM test suite show that, in specific benchmarks, this new algorithm achieves code-size reductions up to -7.24% on programs highly optimized by the -Os sequence of passes from clang 17.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑