Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2491956.2462164acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Formal verification of SSA-based optimizations for LLVM

Published: 16 June 2013 Publication History

Abstract

Modern compilers, such as LLVM and GCC, use a static single assignment(SSA) intermediate representation (IR) to simplify and enable many advanced optimizations. However, formally verifying the correctness of SSA-based optimizations is challenging because SSA properties depend on a function's entire control-flow graph.
This paper addresses this challenge by developing a proof technique for proving SSA-based program invariants and compiler optimizations. We use this technique in the Coq proof assistant to create mechanized correctness proofs of several "micro" transformations that form the building blocks for larger SSA optimizations. To demonstrate the utility of this approach, we formally verify a variant of LLVM's mem2reg transformation in Vellvm, a Coq-based formal semantics of the LLVM IR. The extracted implementation generates code with performance comparable to that of LLVM's unverified implementation.

References

[1]
Static Single Assignment Book, 2012. Working draft available at http://ssabook.gforge.inria.fr/latest/book.pdf.
[2]
A. W. Appel. SSA is functional programming. SIGPLAN Not., 33(4): 17--20, April 1998. ISSN 0362-1340.
[3]
J. Aycock and N. Horspool. Simple generation of static single assignment form. In CC, 2000.
[4]
G. Barthe, D. Demange, and D. Pichardie. A formally verified SSA-based middle-end - Static Single Assignment meets CompCert. In ESOP, 2012.
[5]
J. O. Blech, S. Glesner, J. Leitner, and S. Mülling. Optimizing code generation from SSA form: A comparison between two formal correctness proofs in Isabelle/HOL. Electron. Notes Theor. Comput. Sci., 141(2):33--51, 2005.
[6]
The Coq Proof Assistant Reference Manual (Version 8.3pl1). The Coq Development Team, 2011.
[7]
R. Cytron, J. Ferrante, B. K. Rosen, M. N.Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. TOPLAS, 13:451--490, 1991.
[8]
R. A. Kelsey. A correspondence between continuation passing style and static single assignment form. In IR, number 3, 1995.
[9]
X. Leroy. A formally verified compiler back-end. Journal of Automated Reasoning, 43(4):363--446, December 2009. ISSN 0168-7433.
[10]
The LLVM Reference Manual (Version 3.0). The LLVM Development Team, 2011. http://llvm.org/releases/3.0/docs/LangRef.html.
[11]
W. Mansky and E. L. Gunter. A framework for formal verification of compiler optimizations. In ITP, 2010.
[12]
Y. Matsuno and A. Ohori. A type system equivalent to static single assignment. In PPDP, 2006.
[13]
V. S. Menon, N. Glew, B. R. Murphy, A. McCreight, T. Shpeisman, A. Adl-Tabatabai, and L. Petersen. A verifiable SSA program representation for aggressive compiler optimization. In POPL, 2006.
[14]
S. S. Muchnick. Advanced compiler design and implementation. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1997. ISBN 1-55860-320-4.
[15]
V. C. Sreedhar and G. R. Gao. A linear time algorithm for placing"-nodes. In POPL, 1995.
[16]
J.-B. Tristan and X. Leroy. Formal verification of translation validators: a case study on instruction scheduling optimizations. In POPL, 2008.
[17]
J.-B. Tristan and X. Leroy. Verified validation of lazy code motion. In PLDI, 2009.
[18]
J. B. Tristan and X. Leroy. A simple, verified validator for software pipelining. In POPL, 2010.
[19]
B. Yakobowski. Étude sémantique dun langage intermédiaire de type Static Single Assignment. Rapport de dea (Master's thesis), ENS Cachan and INRIA Rocquencourt, Sept. 2004.
[20]
X. Yang, Y. Chen, E. Eide, and J. Regehr. Finding and understanding bugs in C compilers. In PLDI, 2011.
[21]
J. Zhao and S. Zdancewic. Mechanized verification of computing dominators for formalizing compilers. In CPP, 2012.
[22]
J. Zhao, S. Nagarakatte, M. M. K. Martin, and S. Zdancewic. For-malizing the LLVM intermediate representation for verified program transformations. In POPL, 2012.

Cited By

View all
  • (2025)TensorRight: Automated Verification of Tensor Graph RewritesProceedings of the ACM on Programming Languages10.1145/37048659:POPL(832-863)Online publication date: 9-Jan-2025
  • (2025)Program Correctness through Self-CertificationCommunications of the ACM10.1145/368962468:2(74-84)Online publication date: 13-Jan-2025
  • (2025)Debugger Toolchain Validation via Cross-Level DebuggingProceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 110.1145/3669940.3707271(280-294)Online publication date: 30-Mar-2025
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLDI '13: Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation
June 2013
546 pages
ISBN:9781450320146
DOI:10.1145/2491956
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 48, Issue 6
    PLDI '13
    June 2013
    515 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2499370
    Issue’s Table of Contents
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 ACM 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: 16 June 2013

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. coq
  2. llvm
  3. single static assignment

Qualifiers

  • Research-article

Conference

PLDI '13
Sponsor:

Acceptance Rates

PLDI '13 Paper Acceptance Rate 46 of 267 submissions, 17%;
Overall Acceptance Rate 406 of 2,067 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)64
  • Downloads (Last 6 weeks)6
Reflects downloads up to 25 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)TensorRight: Automated Verification of Tensor Graph RewritesProceedings of the ACM on Programming Languages10.1145/37048659:POPL(832-863)Online publication date: 9-Jan-2025
  • (2025)Program Correctness through Self-CertificationCommunications of the ACM10.1145/368962468:2(74-84)Online publication date: 13-Jan-2025
  • (2025)Debugger Toolchain Validation via Cross-Level DebuggingProceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 110.1145/3669940.3707271(280-294)Online publication date: 30-Mar-2025
  • (2024)UFO Instruction Graphs Are Machine KnittableACM Transactions on Graphics10.1145/368794843:6(1-22)Online publication date: 19-Dec-2024
  • (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)First Steps towards Deductive Verification of LLVM IRFundamental Approaches to Software Engineering10.1007/978-3-031-57259-3_15(290-303)Online publication date: 6-Apr-2024
  • (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
  • (2023)Optimization of Access Address Calculation for LLVM2023 4th International Conference on Information Science, Parallel and Distributed Systems (ISPDS)10.1109/ISPDS58840.2023.10235678(458-464)Online publication date: 14-Jul-2023
  • 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