论文标题
释放编译器中间表示的力量以增强神经程序嵌入
Unleashing the Power of Compiler Intermediate Representation to Enhance Neural Program Embeddings
论文作者
论文摘要
神经程序嵌入在一系列程序分析任务中表现出了巨大的希望,包括克隆识别,程序维修,代码完成和程序合成。但是,大多数现有方法直接从程序源代码中生成神经程序嵌入,通过从令牌,抽象语法树和控制流程图等功能中学习。本文通过利用编译器中间表示(IR)来重新研究如何改善程序嵌入。我们首先通过训练嵌入模型与源代码和默认优化级别生成的LLVM IR(例如-O2)一起训练嵌入模型,以提高嵌入质量的简单而高效的方法。然后,我们介绍了基于遗传算法(GA)的框架IRGEN,以识别(接近)优化标志的最佳序列,可以显着改善嵌入质量。
Neural program embeddings have demonstrated considerable promise in a range of program analysis tasks, including clone identification, program repair, code completion, and program synthesis. However, most existing methods generate neural program embeddings directly from the program source codes, by learning from features such as tokens, abstract syntax trees, and control flow graphs. This paper takes a fresh look at how to improve program embeddings by leveraging compiler intermediate representation (IR). We first demonstrate simple yet highly effective methods for enhancing embedding quality by training embedding models alongside source code and LLVM IR generated by default optimization levels (e.g., -O2). We then introduce IRGen, a framework based on genetic algorithms (GA), to identify (near-)optimal sequences of optimization flags that can significantly improve embedding quality.