Verified validation of lazy code motion

Translation validation establishes a posteriori the correctness of a run of a compilation pass or other program transformation. In this paper, we develop an efficient translation validation algorithm for the Lazy Code Motion (LCM) optimization. LCM is an interesting challenge for validation because it is a global optimization that moves code across loops. Consequently, care must be taken not to move computations that may fail before loops that may not terminate. Our validator includes a specific check for anticipability to rule out such incorrect moves. We present a mechanically-checked proof of correctness of the validation algorithm, using the Coq proof assistant. Combining our validator with an unverified implementation of LCM, we obtain a LCM pass that is provably semantics-preserving and was integrated in the CompCert formally verified compiler.

[1]  Yves Bertot,et al.  Interactive Theorem Proving and Program Development: Coq'Art The Calculus of Inductive Constructions , 2010 .

[2]  Xavier Leroy,et al.  Formal certification of a compiler back-end or: programming a compiler with a proof assistant , 2006, POPL '06.

[3]  George C. Necula,et al.  Translation validation for an optimizing compiler , 2000, PLDI '00.

[4]  Bernhard Steffen,et al.  Lazy code motion , 1992, PLDI '92.

[5]  Amir Pnueli,et al.  Translation Validation , 1998, TACAS.

[6]  Amir Pnueli,et al.  TVOC: A Translation Validator for Optimizing Compilers , 2005, CAV.

[7]  Pierre Castéran,et al.  Interactive Theorem Proving and Program Development , 2004, Texts in Theoretical Computer Science An EATCS Series.

[8]  Bernhard Steffen,et al.  Optimal code motion: theory and practice , 1994, TOPL.

[9]  Xavier Leroy,et al.  Formal Verification of a C-like Memory Model and Its Uses for Verifying Program Transformations , 2008, Journal of Automated Reasoning.

[10]  Sorin Lerner,et al.  Automatically proving the correctness of compiler optimizations , 2003, PLDI '03.

[11]  Amir Pnueli,et al.  CoVaC: Compiler Validation by Program Analysis of the Cross-Product , 2008, FM.

[12]  Amir Pnueli,et al.  VOC: A Methodology for the Translation Validation of OptimizingCompilers , 2003, J. Univers. Comput. Sci..

[13]  Rajiv Gupta,et al.  Complete removal of redundant expressions , 1998, PLDI 1998.

[14]  Martin Rinard,et al.  Credible Compilation with Pointers , 1999 .

[15]  Bernhard Steffen,et al.  Property-Oriented Expansion , 1996, SAS.

[16]  Aditya Kanade,et al.  A PVS Based Framework for Validating Compiler Optimizations , 2006, Fourth IEEE International Conference on Software Engineering and Formal Methods (SEFM'06).

[17]  Xavier Leroy,et al.  Formal verification of translation validators: a case study on instruction scheduling optimizations , 2008, POPL '08.

[18]  Sumit Gulwani,et al.  A Polynomial-Time Algorithm for Global Value Numbering , 2004, SAS.

[19]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[20]  Etienne Morel,et al.  Global optimization by suppression of partial redundancies , 1979, CACM.

[21]  Amir Pnueli,et al.  Validation of Optimizing Compilers , 2001 .

[22]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[23]  Xavier Rival,et al.  Symbolic transfer function-based approaches to certified compilation , 2004, POPL.

[24]  Rajiv Gupta,et al.  Complete removal of redundant expressions , 1998, PLDI 1998.

[25]  Mary Lou Soffa,et al.  Catching and Identifying Bugs in Register Allocation , 2006, SAS.

[26]  Wolfgang J. Paul,et al.  Towards the Formal Verification of a C0 Compiler: Code Generation and Implementation Correctnes , 2005, SEFM.

[27]  Sumit Gulwani,et al.  A polynomial-time algorithm for global value numbering , 2004, Sci. Comput. Program..

[28]  Sabine Glesner,et al.  Program Checking with Certificates: Separating Correctness-Critical Code , 2003, FME.

[29]  Amir Pnueli,et al.  The Code Validation Tool (CVT) , 1998, International Journal on Software Tools for Technology Transfer (STTT).

[30]  Xavier Leroy,et al.  A Formally Verified Compiler Back-end , 2009, Journal of Automated Reasoning.

[31]  Sabine Glesner,et al.  Formal verification of dead code elimination in Isabelle/HOL , 2005, Third IEEE International Conference on Software Engineering and Formal Methods (SEFM'05).