skip to main content
10.1145/3192366.3192377acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Crellvm: verified credible compilation for LLVM

Published: 11 June 2018 Publication History

Abstract

Production compilers such as GCC and LLVM are large complex software systems, for which achieving a high level of reliability is hard. Although testing is an effective method for finding bugs, it alone cannot guarantee a high level of reliability. To provide a higher level of reliability, many approaches that examine compilers' internal logics have been proposed. However, none of them have been successfully applied to major optimizations of production compilers.
This paper presents Crellvm: a verified credible compilation framework for LLVM, which can be used as a systematic way of providing a high level of reliability for major optimizations in LLVM. Specifically, we augment an LLVM optimizer to generate translation results together with their correctness proofs, which can then be checked by a proof checker formally verified in Coq. As case studies, we applied our approach to two major optimizations of LLVM: register promotion mem2reg and global value numbering gvn, having found four new miscompilation bugs (two in each).

Supplementary Material

WEBM File (p631-kang.webm)

References

[1]
Supplementary material for this paper, available at http://sf.snu.ac.kr/ crellvm/ .
[2]
Andrew W. Appel. 2001. Foundational Proof-Carrying Code (LICS ’01).
[3]
The Coq Proof Assistant. https://coq.inria.fr/ .
[4]
Gilles Barthe, Delphine Demange, and David Pichardie. 2014. Formal Verification of an SSA-Based Middle-End for CompCert. ACM Trans. Program. Lang. Syst. 36, 1 (March 2014).
[5]
The SPEC CINT2006 Benchmark. https://www.spec.org/cpu2006/ CINT2006/ .
[6]
Nick Benton. 2004. Simple Relational Correctness Proofs for Static Analyses and Program Transformations (POPL ’04).
[7]
Yang Chen, Alex Groce, Chaoqiang Zhang, Weng-Keen Wong, Xiaoli Fern, Eric Eide, and John Regehr. 2013. Taming Compiler Fuzzers (PLDI ’13).
[8]
Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. 1991. Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. ACM Trans. Program. Lang. Syst. 13, 4 (Oct. 1991).
[9]
Delphine Demange, David Pichardie, and Léo Stefanesco. 2016. Verifying Fast and Sparse SSA-Based Optimizations in Coq (CC ’16).
[10]
Chris Hawblitzel, Shuvendu K. Lahiri, Kshama Pawar, Hammad Hashmi, Sedar Gokbulut, Lakshan Fernando, Dave Detlefs, and Scott Wadsworth. 2013. Will You Still Compile Me Tomorrow? Static Crossversion Compiler Validation (ESEC/FSE ’13).
[11]
Chung-Kil Hur, Derek Dreyer, Georg Neis, and Viktor Vafeiadis. 2012. The Marriage of Bisimulations and Kripke Logical Relations. In POPL.
[12]
Jeehoon Kang, Chung-Kil Hur, William Mansky, Dmitri Garbuzov, Steve Zdancewic, and Viktor Vafeiadis. 2015. A Formal C Memory Model Supporting Integer-pointer Casts (PLDI ’15).
[13]
Ramana Kumar, Magnus O. Myreen, Michael Norrish, and Scott Owens. 2014. CakeML: A Verified Implementation of ML (POPL ’14).
[14]
Vu Le, Mehrdad Afshari, and Zhendong Su. 2014. Compiler Validation via Equivalence Modulo Inputs (PLDI ’14).
[15]
Juneyoung Lee, Yoonseung Kim, Youngju Song, Chung-Kil Hur, Sanjoy Das, David Majnemer, John Regehr, and Nuno P. Lopes. 2017. Taming Undefined Behavior in LLVM (PLDI ’17).
[16]
Xavier Leroy. 2006. Formal Certification of a Compiler Back-end or: Programming a Compiler with a Proof Assistant (POPL ’06).
[17]
Xavier Leroy. 2009. Formal verification of a realistic compiler. Commun. ACM (2009).
[18]
Xavier Leroy, Andrew W. Appel, Sandrine Blazy, and Gordon Stewart. 2012. The CompCert Memory Model, Version 2. Research report RR-7987. INRIA.
[19]
LLVM Linux. http://llvm.linuxfoundation.org .
[20]
Nuno P. Lopes, David Menendez, Santosh Nagarakatte, and John Regehr. 2015. Provably Correct Peephole Optimizations with Alive (PLDI ’15).
[21]
David Menendez and Santosh Nagarakatte. 2017. Alive-Infer: Datadriven Precondition Inference for Peephole Optimizations in LLVM (PLDI ’17).
[22]
David Menendez, Santosh Nagarakatte, and Aarti Gupta. 2016. AliveFP: Automated Verification of Floating Point Based Peephole Optimizations in LLVM (SAS ’16).
[23]
Kedar S. Namjoshi, Giacomo Tagliabue, and Lenore D. Zuck. 2013. A Witnessing Compiler: A Proof of Concept (RV ’13).
[24]
Kedar S. Namjoshi and Lenore D. Zuck. 2013. Witnessing Program Transformations (SAS ’13).
[25]
George C. Necula. 1997. Proof-carrying Code (POPL ’97).
[26]
George C. Necula. 2000. Translation Validation for an Optimizing Compiler (PLDI ’00).
[27]
Hakjoo Oh, Kihong Heo, Wonchan Lee, Woosuk Lee, Daejun Park, Jeehoon Kang, and Kwangkeun Yi. 2014. Global Sparse Analysis Framework. ACM Trans. Program. Lang. Syst. 36, 3 (Sept. 2014).
[28]
Amir Pnueli, Michael Siegel, and Eli Singerman. 1998. Translation Validation (TACAS ’98).
[29]
Amir Pnueli, Ofer Strichman, and Michael Siegel. 1998. The Code Validation Tool CVT: Automatic Verification of a Compilation Process (STTT ’98).
[30]
HOL Interactive Theorem Prover. https://hol- theorem- prover.org/ .
[31]
The Z3 Theorem Prover. https://github.com/Z3Prover/z3 .
[32]
John Regehr, Yang Chen, Pascal Cuoq, Eric Eide, Chucky Ellison, and Xuejun Yang. 2012. Test-case reduction for C compiler bugs (PLDI ’12).
[33]
Silvain Rideau and Xavier Leroy. 2010. Validating Register Allocation and Spilling (CC ’10).
[34]
Martin C. Rinard and Darko Marinov. 1999. Credible Compilation with Pointers (RRV ’99).
[35]
Hanan Samet. 1978. Proving the Correctness of Heuristically Optimized Code (ACM ’78).
[36]
Michael Stepp, Ross Tate, and Sorin Lerner. 2011. Equality-based Translation Validator for LLVM (CAV ’11).
[37]
Ross Tate, Michael Stepp, Zachary Tatlock, and Sorin Lerner. 2009. Equality Saturation: A New Approach to Optimization (POPL ’09).
[38]
Zachary Tatlock and Sorin Lerner. 2010. Bringing Extensibility to Verified Compilers (PLDI ’10).
[39]
Jean-Baptiste Tristan, Paul Govereau, and Greg Morrisett. 2011. Evaluating Value-graph Translation Validation for LLVM (PLDI ’11).
[40]
Jean-Baptiste Tristan and Xavier Leroy. 2008. Formal Verification of Translation Validators: A Case Study on Instruction Scheduling Optimizations (POPL ’08).
[41]
Jean-Baptiste Tristan and Xavier Leroy. 2009. Verified Validation of Lazy Code Motion (PLDI ’09).
[42]
Jean-Baptiste Tristan and Xavier Leroy. 2010. A Simple, Verified Validator for Software Pipelining (POPL ’10).
[43]
Xuejun Yang, Yang Chen, Eric Eide, and John Regehr. 2011. Finding and Understanding Bugs in C Compilers (PLDI ’11).
[44]
Anna Zaks and Amir Pnueli. 2008. CoVaC: Compiler Validation by Program Analysis of the Cross-Product (FM ’08).
[45]
Jianzhou Zhao, Santosh Nagarakatte, Milo M.K. Martin, and Steve Zdancewic. 2012. Formalizing the LLVM Intermediate Representation for Verified Program Transformations (POPL ’12).
[46]
Jianzhou Zhao, Santosh Nagarakatte, Milo M.K. Martin, and Steve Zdancewic. 2013. Formal Verification of SSA-based Optimizations for LLVM (PLDI ’13).
[47]
Lenore Zuck, Amir Pnueli, Benjamin Goldberg, Clark Barrett, Yi Fang, and Ying Hu. 2002. Translation and Run-Time Validation of Loop Transformations (RV ’02).
[48]
Lenore D. Zuck, Amir Pnueli, and Benjamin Goldberg. 2003. VOC: A Methodology for the Translation Validation of Optimizing Compilers (J. UCS ’03).

Cited By

View all
  • (2025)Monadic Interpreters for Concurrent Memory ModelsProceedings of the 14th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3703595.3705890(283-298)Online publication date: 10-Jan-2025
  • (2024)Modeling Dynamic (De)Allocations of Local Memory for Translation ValidationProceedings of the ACM on Programming Languages10.1145/36498638:OOPSLA1(1463-1492)Online publication date: 29-Apr-2024
  • (2024) SimplMMJournal of Systems Architecture: the EUROMICRO Journal10.1016/j.sysarc.2023.103049147:COnline publication date: 17-Apr-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation
June 2018
825 pages
ISBN:9781450356985
DOI:10.1145/3192366
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 June 2018

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Coq
  2. LLVM
  3. compiler verification
  4. credible compilation
  5. relational Hoare logic
  6. translation validation

Qualifiers

  • Research-article

Funding Sources

  • Samsung Research Funding Center of Samsung Electronics

Conference

PLDI '18
Sponsor:

Acceptance Rates

Overall Acceptance Rate 406 of 2,067 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)70
  • Downloads (Last 6 weeks)8
Reflects downloads up to 08 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Monadic Interpreters for Concurrent Memory ModelsProceedings of the 14th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3703595.3705890(283-298)Online publication date: 10-Jan-2025
  • (2024)Modeling Dynamic (De)Allocations of Local Memory for Translation ValidationProceedings of the ACM on Programming Languages10.1145/36498638:OOPSLA1(1463-1492)Online publication date: 29-Apr-2024
  • (2024) SimplMMJournal of Systems Architecture: the EUROMICRO Journal10.1016/j.sysarc.2023.103049147:COnline publication date: 17-Apr-2024
  • (2024) ThreadAbsJournal of Systems Architecture: the EUROMICRO Journal10.1016/j.sysarc.2023.103046147:COnline publication date: 17-Apr-2024
  • (2024)A framework for embedded software portability and verification: from formal models to low-level codeSoftware and Systems Modeling10.1007/s10270-023-01144-y23:2(289-315)Online publication date: 1-Feb-2024
  • (2023)Formally Verifying Optimizations with Block SimulationsProceedings of the ACM on Programming Languages10.1145/36227997:OOPSLA2(59-88)Online publication date: 16-Oct-2023
  • (2023)Formally Verified Native Code Generation in an Effectful JIT: Turning the CompCert Backend into a Formally Verified JIT CompilerProceedings of the ACM on Programming Languages10.1145/35712027:POPL(249-277)Online publication date: 11-Jan-2023
  • (2022)Leapfrog: certified equivalence for protocol parsersProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523715(950-965)Online publication date: 9-Jun-2022
  • (2022)A framework for OS portabilityProceedings of the 37th ACM/SIGAPP Symposium on Applied Computing10.1145/3477314.3506996(1156-1165)Online publication date: 25-Apr-2022
  • (2022)High‐coverage metamorphic testing of concurrency support in C compilersSoftware Testing, Verification and Reliability10.1002/stvr.181232:4Online publication date: 22-Mar-2022
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media