Formal verification of dead code elimination in Isabelle/HOL

Correct compilers are a vital precondition to ensure software correctness. Optimizations are the most error-prone phases in compilers. In this paper, we formally verify dead code elimination (DCE) within the theorem prover Isabelle/HOL. DCE is a popular optimization in compilers which is typically performed on the intermediate representation. In our work, we reformulate the algorithm for DCE so that it is applicable to static single assignment (SSA) form which is a state of the art intermediate representation in modern compilers, thereby showing that DCE is significantly simpler on SSA form than on classical intermediate representations. Moreover, we formally prove our algorithm correct within the theorem prover Isabelle/HOL. Our program equivalence criterion used in this proof is based on bisimulation and, hence, captures also the case of non-termination adequately. Finally we report on our implementation of this verified DCE algorithm in the industrial-strength scale compiler system.

[1]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[2]  Tobias Nipkow,et al.  Verified Lexical Analysis , 1998, TPHOLs.

[3]  Edmund M. Clarke,et al.  Model Checking , 1999, Handbook of Automated Reasoning.

[4]  David A. Schmidt Data flow analysis is model checking of abstract interpretations , 1998, POPL '98.

[5]  David F. Martin,et al.  Toward compiler implementation correctness proofs , 1986, TOPL.

[6]  Tobias Nipkow,et al.  Verified Bytecode Verifiers , 2001, FoSSaCS.

[7]  Flemming Nielson,et al.  Principles of Program Analysis , 1999, Springer Berlin Heidelberg.

[8]  J. Strother Moore,et al.  A mechanically verified language implementation , 1989, Journal of Automated Reasoning.

[9]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[10]  Martin Strecker,et al.  Formal Verification of a Java Compiler in Isabelle , 2002, CADE.

[11]  John McCarthy,et al.  Correctness of a compiler for arithmetic expressions , 1966 .

[12]  Axel Dold,et al.  A Completely Verified Realistic Bootstrap Compiler , 2003, Int. J. Found. Comput. Sci..

[13]  Gerhard Goos,et al.  Construction of Verified Compiler Front-Ends with Program-Checking , 1999, Ershov Memorial Conference.

[14]  Lawrence Charles Paulson,et al.  Isabelle/HOL: A Proof Assistant for Higher-Order Logic , 2002 .

[15]  J. van Leeuwen,et al.  Theorem Proving in Higher Order Logics , 1999, Lecture Notes in Computer Science.

[16]  Gerhard Goos,et al.  Verifix: Konstruktion und Architektur verifizierender Übersetzer (Verifix: Construction and Architecture of Verifying Compilers) , 2004, it Inf. Technol..

[17]  Sabine Glesner,et al.  A Formal Correctness Proof for Code Generation from SSA Form in Isabelle/HOL , 2004, GI Jahrestagung.

[18]  Jan Olaf Blech,et al.  Eine formale Semantik fSSA Zwischensprachen in Isabelle/HOL , 2004 .

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