• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

Computer Engineering & Science ›› 2025, Vol. 47 ›› Issue (10): 1890-1900.

• Artificial Intelligence and Data Mining • Previous Articles    

Research on compiler optimization methods based on source code migration

ZHOU Fang,LIU Maofu,LI Shanzhi   

  1. (1.School of Computer Science and Technology,Wuhan University of Science and Technology,Wuhan 430065;
    2.Hubei Province Key Laboratory of Intelligent Information Processing and Real-Time Industrial System,Wuhan 430065;
    3.School of Computer,Wuhan Qingchuan University,Wuhan 430204,China)
  • Received:2024-03-01 Revised:2024-08-14 Online:2025-10-25 Published:2025-10-29

Abstract: Compiler optimization aims to enhance the efficiency of code execution on target platforms by applying a series of transformations to the intermediate representation (IR) language. Traditional methods typically rely on machine learning to analyze IR features and predict the optimal combination of LLVM compiler optimization passes. However, these methods are limited by their reliance on existing compiler optimization strategies and insufficient use of global information, which limits their scalability. This study adopts deep learning to automatically translate function-level IR from an unoptimized state to the O2 optimization level, treating this optimization process as a translation task. By integrating a dense data flow graph (DDFG), this method is able to extract the global structural information from the IR code, thereby guiding the model to learn code semantics more comprehensively. Experiments using the Transformer model demonstrate that this method can effectively train IR at the O2 level, and 86.15% of the function-level optimized code can execute correctly on the compiler while ensuring semantic integrity.

Key words: compiler optimization, code translation, dense data flow graph(DDFG), data flow prediction