Provably correct peephole optimizations with alive

@article{Lopes2015ProvablyCP,
  title={Provably correct peephole optimizations with alive},
  author={Nuno P. Lopes and David Menendez and Santosh Nagarakatte and John Regehr},
  journal={Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation},
  year={2015}
}
  • Nuno P. Lopes, David Menendez, J. Regehr
  • Published 3 June 2015
  • Computer Science
  • Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation
Compilers should not miscompile. Our work addresses problems in developing peephole optimizations that perform local rewriting to improve the efficiency of LLVM code. These optimizations are individually difficult to get right, particularly in the presence of undefined behavior; taken together they represent a persistent source of bugs. This paper presents Alive, a domain-specific language for writing optimizations and for automatically either proving them correct or else generating… 

Figures and Tables from this paper

Practical verification of peephole optimizations with Alive
TLDR
Alive is a domain-specific language for writing optimizations and for automatically either proving them correct or else generating counterexamples, which can be automatically translated into C++ code that is suitable for inclusion in an LLVM optimization pass.
Termination-Checking for LLVM Peephole Optimizations
TLDR
A methodology to detect non-termination bugs with a suite of peephole optimizations, the necessary condition to ensure termination while composing peep hole optimizations is identified, and debugging support is provided by generating concrete input programs that cause non-terminating compilation in LLVM with Alive-generated C++ code.
Practical formal techniques and tools for developing LLVM’s peephole optimizations
TLDR
This dissertation presents Alive, a domain-specific language for specifying peephole optimizations in LLVM, and the Alive-NJ toolkit, which automatically checks the correctness of integerand floating point-based optimizations.
Alive-FP: Automated Verification of Floating Point Based Peephole Optimizations in LLVM
TLDR
This paper proposes Alive-FP, an automated verification framework for floating point based peephole optimizations in LLVM that handles a class of floating point optimizations and fast-math optimizations involving signed zeros, not-a-number, and infinities, which do not result in loss of accuracy.
Translation Validation for the LLVM Compiler
TLDR
Alive is extended to 1) reduce the SMT formula sizes generated to improve performance and 2) significantly increase analysis coverage with a new loop unrolling algorithm for loops written in Alive IR.
Precondition Inference for Peephole Optimizations in LLVM
TLDR
This paper proposes ALIVE-INFER, a data-driven approach that infers preconditions for peephole optimizations expressed in Alive, and demonstrates the applicability of this technique to generalize 54 optimization patterns generated by Souper, an LLVM~IR--based superoptimizer.
AliveInLean: A Verified LLVM Peephole Optimization Verifier
TLDR
Alive is a tool for verifying LLVM’s peephole optimizations and has helped compiler developers proactively find dozens of bugs in LLVM, avoiding potentially hazardous miscompilations.
LifeJacket: verifying precise floating-point optimizations in LLVM
TLDR
An approach to automate reasoning about precise floating-point optimizations using satisfiability modulo theories (SMT) solvers is presented, and the approach is implemented in LifeJacket, a system for automatically verifying precise Floating- point optimizations for the LLVM assembly language.
Taming undefined behavior in LLVM
TLDR
The current semantics of LLVM's IR fails to justify some cases of loop unswitching, global value numbering, and other important "textbook" optimizations, causing long-standing bugs.
Performance Exploration Through Optimistic Static Program Annotations
TLDR
Analysis to guarantee the absence of disruptive and unlikely situations are consequently an indispensable part of an optimizing compiler, however, such analyses have to be approximative and limited in scope as global and exact solutions are infeasible for any non-trivial program.
...
1
2
3
4
5
...

References

SHOWING 1-10 OF 41 REFERENCES
Common Compiler Optimisations are Invalid in the C11 Memory Model and what we can do about it
TLDR
It is shown that the weak memory model introduced by the 2011 C and C++ standards does not permit many common source-to-source program transformations that modern compilers perform and that are deemed to be correct.
Formal verification of SSA-based optimizations for LLVM
TLDR
This paper develops a proof technique for proving SSA-based program invariants and compiler optimizations and uses 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.
Evaluating value-graph translation validation for LLVM
TLDR
The design of a translation validator for LLVM's intra-procedural optimizations is presented, a design that does not require any instrumentation of the optimizer, nor any rewriting of the source code to compile, and needs to run only once to validate a pipeline of optimizations.
Automated soundness proofs for dataflow analyses and transformations via local rules
TLDR
Rhodium is presented, a new language for writing compiler optimizations that can be automatically proved sound, and has specified and automatically proven the soundness of all of Cobalt's optimizations plus a variety of optimizations not expressible in Cobalt.
Translation validation for a verified OS kernel
TLDR
An approach for proving refinement between the formal semantics of a program on the C source level and its formal semantics on the binary level, thus checking the validity of compilation, including some optimisations, and linking, and extending static properties proved of the source code to the executable is presented.
Finding and understanding bugs in C compilers
TLDR
Csmith, a randomized test-case generation tool, is created and spent three years using it to find compiler bugs, and a collection of qualitative and quantitative results about the bugs it found are presented.
Automatic generation of peephole superoptimizers
TLDR
It is shown experimentally that the fully automatic construction of peephole optimizers using brute force superoptimization is able to exploit performance opportunities not found by existing compilers, and speedups from 1.7 to a factor of 10 on some compute intensive kernels over a conventional optimizing compiler are shown.
Will you still compile me tomorrow? static cross-version compiler validation
TLDR
The validator ran on over 500,000 methods across a large suite of test programs, finding 12 previously unknown correctness and performance bugs in the CLR compiler.
A Cross-Language Framework for Verifying Compiler Optimizations
TLDR
By generalizing across elements such as concurrent memory models and single-thread operational semantics, this paper can build a library of facts that can be reused in verifying optimizations for dramatically different target languages, such as stack-machine and register-machine languages.
Compiler Optimization Correctness by Temporal Logic
TLDR
In this paper, programs are written in an intermediate language and transformation-enabling side conditions are specified in a temporal logic suitable for describing program data flow, to show how transformations may be proven correct.
...
1
2
3
4
5
...