Reconciling High-Level Optimizations and Low-Level Code in LLVM

被引:0
|
作者
Lee, Juneyoung [1 ]
Hur, Chung-Kil [1 ]
Jung, Ralf [2 ]
Liu, Zhengyang [3 ]
Regehr, John [3 ]
Lopes, Nuno P. [4 ]
机构
[1] Seoul Natl Univ, Seoul, South Korea
[2] MPI SWS, Saarbrucken, Germany
[3] Univ Utah, Salt Lake City, UT 84112 USA
[4] Microsoft Res, Cambridge, England
基金
美国国家科学基金会; 新加坡国家研究基金会;
关键词
IR Memory Model; LLVM;
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
LLVM miscompiles certain programs in C, C++, and Rust that use low-level language features such as raw pointers in Rust or conversion between integers and pointers in C or C++. The problem is that it is difficult for the compiler to implement aggressive, high-level memory optimizations while also respecting the guarantees made by the programming languages to low-level programs. A deeper problem is that the memory model for LLVM's intermediate representation (IR) is informal and the semantics of corner cases are not always clear to all compiler developers. We developed a novel memory model for LLVM IR and formalized it. The new model requires a handful of problematic IR-level optimizations to be removed, but it also supports the addition of new optimizations that were not previously legal. We have implemented the new model and shown that it fixes known memory-model-related miscompilations without impacting the quality of generated code.
引用
收藏
页数:28
相关论文
共 50 条
  • [1] Reconciling High-Level Optimizations and Low-Level Code in LLVM
    Lee, Juneyoung
    Hur, Chung-Kil
    Jung, Ralf
    Liu, Zhengyang
    Regehr, John
    Lopes, Nuno P.
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
  • [2] High-Level Separation Logic for Low-Level Code
    Jensen, Jonas B.
    Benton, Nick
    Kennedy, Andrew
    ACM SIGPLAN NOTICES, 2013, 48 (01) : 301 - 313
  • [3] High-level views on low-level representations
    Diatchki, IS
    Jones, MP
    Leslie, R
    ACM SIGPLAN NOTICES, 2005, 40 (09) : 168 - 179
  • [4] The High-Level Benefits of Low-Level Sandboxing
    Sammler, Michael
    Garg, Deepak
    Dreyer, Derek
    Litak, Tadeusz
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4 (POPL):
  • [5] LOW-LEVEL WASTE, HIGH-LEVEL PROBLEM
    SKERRETT, PJ
    TECHNOLOGY REVIEW, 1991, 94 (06): : 9 - &
  • [6] HIGH-LEVEL BINDING WITH LOW-LEVEL LINKERS
    HAMLET, RG
    COMMUNICATIONS OF THE ACM, 1976, 19 (11) : 642 - 644
  • [7] HIGH-LEVEL WASTE, LOW-LEVEL LOGIC
    SCHRADERFRECHETTE, K
    BULLETIN OF THE ATOMIC SCIENTISTS, 1994, 50 (06) : 40 - 45
  • [8] LOW-LEVEL RADIATION - HIGH-LEVEL CONCERN
    HOLDEN, C
    SCIENCE, 1979, 204 (4389) : 155 - 158
  • [9] HIGH-LEVEL COMPILING FOR LOW-LEVEL MACHINES
    ODONNELL, C
    IFIP TRANSACTIONS A-COMPUTER SCIENCE AND TECHNOLOGY, 1993, 23 : 309 - 320
  • [10] Verifying Low-Level Implementations of High-Level Datatypes
    Conway, Christopher L.
    Barrett, Clark
    COMPUTER AIDED VERIFICATION, PROCEEDINGS, 2010, 6174 : 306 - 320