Nuno P. Lopes and José Monteiro
Compiler optimizations play an increasingly important role in code generation. This is especially true with the advent of resource-limited mobile devices. We rely on compiler optimizations to improve performance, reduce code size, and reduce power consumption of our programs.
Despite being a mature field, compiler optimizations are still designed and implemented by hand, and usually without providing any guarantee of correctness.
In addition to devising the code transformations, designers and implementers have to come up with an analysis that determines in which cases the optimization can be safely applied. In other words, the optimization designer has to specify a precondition that ensures that the optimization is semantics-preserving. However, devising preconditions for optimizations by hand is a non-trivial task. It is easy to specify a precondition that, although correct, is too restrictive, and therefore misses some optimization opportunities.
In this paper, we propose, to the best of our knowledge, the first algorithm for the automatic synthesis of preconditions for compiler optimizations. The synthesized preconditions are provably correct by construction, and they are guaranteed to be the weakest in the precondition language that we consider.
We implemented the proposed technique in a tool named PSyCO. We present examples of preconditions synthesized by PSyCO, as well as the results of running PSyCO on a set of optimizations.
N. P. Lopes and J. Monteiro. Weakest Precondition Synthesis for Compiler Optimizations. In Proc. of the 15th International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI), Jan. 2014.
@inproceedings{psyco-vmcai14, title = {Weakest Precondition Synthesis for Compiler Optimizations}, author = {Nuno P. Lopes and Jos\'{e} Monteiro}, booktitle = {Proc. of the 15th International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI)}, doi = {10.1007/978-3-642-54013-4_12}, month = jan, year = 2014 }
The final publication is available at link.springer.com.