Verifying Fast and Sparse SSA-Based Optimizations in Coq

  • Delphine Demange
  • David Pichardie
  • Léo Stefanesco
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9031)


The Static Single Assignment (SSA) form is a predominant technology in modern compilers, enabling powerful and fast program optimizations. Despite its great success in the implementation of production compilers, it is only very recently that this technique has been introduced in verified compilers. As of today, few evidence exist on that, in this context, it also allows faster and simpler optimizations. This work builds on the CompCertSSA verified compiler (an SSA branch of the verified CompCert C compiler). We implement and verify two prevailing SSA optimizations: Sparse Conditional Constant Propagation and Global Value Numbering. For both transformations, we mechanically prove their soundness in the Coq proof assistant. Both optimization proofs are embedded in a single sparse optimization framework, factoring out many of the dominance-based reasoning steps required in proofs of SSA-based optimizations. Our experimental evaluations indicate both a better precision, and a significant compilation time speedup.


Constant Propagation Operational Semantic Proof Obligation Correctness Proof Semantic Preservation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Alpern, B., Wegman, M.N., Zadeck, F.K.: Detecting Equality of Variables in Programs. In: Proc. of POPL 1988, pp. 1–11. ACM, San Diego (1988) ISBN: 0-89791-252-7Google Scholar
  2. 2.
    Barthe, G., Demange, D., Pichardie, D.: Formal Verification of an SSA- Based Middle-End for CompCert. ACM TOPLAS 36(1), 4:1–4:35 (2014) ISSN: 0164-0925Google Scholar
  3. 3.
    Blech, J., et al.: Optimizing Code Generation from SSA Form: A Comparison Between Two Formal Correctness Proofs in Isabelle/HOL. In: COCV 2005. ENTCS, pp. 33–51. Elsevier, Amsterdam (2005)Google Scholar
  4. 4.
    Boissinot, B., et al.: Revisiting Out-of-SSA Translation for Correctness, Code Quality and Efficiency. In: Proc. of the 7th Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2009, pp. 114–125. IEEE Computer Society, Washington, DC (2009) ISBN: 978-0-7695-3576-0Google Scholar
  5. 5.
    Briggs, P., Cooper, K.D., Simpson, L.T.: Value Numbering. Software, Practice and Experience 27(6), 701–724 (1997)CrossRefGoogle Scholar
  6. 6.
    Chlipala, A.: A verified compiler for an impure functional language. In: POPL 2010, pp. 93–106. ACM, New York (2010)Google Scholar
  7. 7.
    Chow, F., et al.: A New Algorithm for Partial Redundancy Elimination Based on SSA Form. In: Proc. of PLDI 1997, pp. 273–286. ACM, New York (1997)Google Scholar
  8. 8.
    Kumar, R., et al.: CakeML: A verified implementation of ML. In: Proc. of POPL 2014, pp. 179–192 (2014)Google Scholar
  9. 9.
    Lengauer, T., Tarjan, R.: A fast algorithm for finding dominators in a flowgraph. ACM TOPLAS 1(1), 121–141 (1979)CrossRefzbMATHGoogle Scholar
  10. 10.
    Leroy, X.: A Formally Verified Compiler Back-end. JAR 43(4), 363–446 (2009)Google Scholar
  11. 11.
    Mansky, W., Gunter, E.: A Framework for Formal Verification of Compiler Optimizations. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 371–386. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  12. 12.
    Pnueli, A., Siegel, M.D., Singerman, E.: Translation validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 151–166. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  13. 13.
    Rideau, S., Leroy, X.: Validating Register Allocation and Spilling. In: Gupta, R. (ed.) CC 2010. LNCS, vol. 6011, pp. 224–243. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  14. 14.
    Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Global Value Numbers and Redundant Computations. In: Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1988, pp. 12–27. ACM, San Diego (1988) ISBN:0- 89791-252-7Google Scholar
  15. 15.
    Stepp, M., Tate, R., Lerner, S.: Equality-Based Translation Validator for LLVM. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 737–742. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  16. 16.
    Tristan, J., Govereau, P., Morrisett, G.: Evaluating value-graph translation validation for LLVM. In: PLDI 2011, pp. 295–305. ACM, New York (2011)Google Scholar
  17. 17.
    Tristan, J., Leroy, X.: A simple, verified validator for software pipelining. In: POPL 2010, pp. 83–92. ACM, New York (2010)Google Scholar
  18. 18.
    Tristan, J., Leroy, X.: Verified validation of lazy code motion. In: PLDI 2009, pp. 316–326. ACM, New York (2009)Google Scholar
  19. 19.
    Wegman, M.N., Zadeck, F.K.: Constant Propagation with Conditional Branches. ACM Trans. Program. Lang. Syst. 13(2), 181–210 (1991)CrossRefGoogle Scholar
  20. 20.
    Yang, X., et al.: Finding and Understanding Bugs in C Compilers. In: Proc. of PLDI 2011, pp. 978–971. ACM, New York (2011) ISBN:978-1-4503-0663-8Google Scholar
  21. 21.
    Zhao, J., et al.: Formal verification of SSA-based optimizations for LLVM. In: PLDI 2013, pp. 175–186. ACM, New York (2013)Google Scholar
  22. 22.
    Zhao, J., et al.: Formalizing the LLVM Intermediate Representation for Verified Program Transformation. In: POPL 2012, pp. 427–440. ACM, New York (2012)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  • Delphine Demange
    • 1
  • David Pichardie
    • 2
  • Léo Stefanesco
    • 3
  1. 1.Université Rennes 1 - IRISA - InriaRennesFrance
  2. 2.ENS Rennes - IRISA - InriaRennesFrance
  3. 3.ENSLyonFrance

Personalised recommendations