Structuring Optimizing Transformations and Proving Them Sound

A compiler optimization is sound if the optimized program that it produces is semantically equivalent to the input program. The proofs of semantic equivalence are usually tedious. To reduce the efforts required, we identify a set of common transformation primitives that can be composed sequentially to obtain specifications of optimizing transformations. We also identify the conditions under which the transformation primitives preserve semantics and prove their sufficiency. Consequently, proving the soundness of an optimization reduces to showing that the soundness conditions of the underlying transformation primitives are satisfied. The program analysis required for optimization is defined over the input program whereas the soundness conditions of a transformation primitive need to be shown on the version of the program on which it is applied. We express both in a temporal logic. We also develop a logic called temporal transformation logic to correlate temporal properties over a program (seen as a Kripke structure) and its transformation. An interesting possibility created by this approach is a novel scheme for validating optimizer implementations. An optimizer can be instrumented to generate a trace of its transformations in terms of the transformation primitives. Conformance of the trace with the optimizer can be checked through simulation. If soundness conditions of the underlying primitives are satisfied by the trace then it preserves semantics.

[1]  Natarajan Shankar,et al.  Evaluating, Testing, and Animating PVS Specications , 2001 .

[2]  Amir Pnueli,et al.  VOC: A Translation Validator for Optimizing Compilers , 2002, COCV@ETAPS.

[3]  Amir Pnueli,et al.  Translation and Run-Time Validation of Loop Transformations , 2005, Formal Methods Syst. Des..

[4]  Ernst-Rüdiger Olderog,et al.  Correct System Design, Recent Insight and Advances, (to Hans Langmaack on the occasion of his retirement from his professorship at the University of Kiel) , 1999 .

[5]  Amir Pnueli,et al.  Translation Validation: From SIGNAL to C , 1999, Correct System Design.

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

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

[8]  Eric Van Wyk,et al.  Proving correctness of compiler optimizations by temporal logic , 2002, POPL '02.

[9]  Sabine Glesner,et al.  Using Program Checking to Ensure the Correctness of Compiler Implementations , 2003, J. Univers. Comput. Sci..

[10]  Arnd Poetzsch-Heffter,et al.  Towards Proof Generating Compilers , 2022 .

[11]  George C. Necula,et al.  The design and implementation of a certifying compiler , 1998, PLDI.

[12]  Benjamin Goldberg,et al.  Into the Loops: Practical Issues in Translation Validation for Optimizing Compilers , 2005, COCV@ETAPS.

[13]  Gerhard Goos,et al.  Verification of Compilers , 1999, Correct System Design.

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

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