skip to main content
research-article

Formally Verified Loop-Invariant Code Motion and Assorted Optimizations

Published:13 December 2022Publication History
Skip Abstract Section

Abstract

We present an approach for implementing a formally certified loop-invariant code motion optimization by composing an unrolling pass and a formally certified yet efficient global subexpression elimination. This approach is lightweight: each pass comes with a simple and independent proof of correctness. Experiments show the approach significantly narrows the performance gap between the CompCert certified compiler and state-of-the-art optimizing compilers. Our static analysis employs an efficient yet verified hashed set structure, resulting in the fast compilation.

REFERENCES

  1. [1] Barthe Gilles, Demange Delphine, and Pichardie David. 2014. Formal verification of an SSA-based middle-end for CompCert. ACM Transactions on Programming Languages and Systems 36, 1 (2014), 4:1–4:35. Retrieved from Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. [2] França Ricardo Bedin, Blazy Sandrine, Favre-Felix Denis, Leroy Xavier, Pantel Marc, and Souyris Jean. 2012. Formally verified optimizing compilation in ACG-based flight control software. In Proceedings of the Embedded Real Time Software and Systems.Google ScholarGoogle Scholar
  3. [3] Bourke Timothy, Brun Lélio, and Pouzet Marc. 2020. Mechanized semantics and verified compilation for a dataflow synchronous language with reset. Proceedings of the ACM on Programming Languages 4, POPL (2020), 129. Retrieved from Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. [4] Braibant Thomas, Jourdan Jacques-Henri, and Monniaux David. 2014. Implementing and reasoning about hash-consed data structures in Coq. Journal of Automated Reasoning 53, 3 (2014), 271304.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. [5] C18 . International Standard—Programming Languages—C. Technical Report 9899:2018. ISO/IEC.Google ScholarGoogle Scholar
  6. [6] Cousot Patrick. 1978. Méthodes itératives de construction et d’approximation de points fixes d’opérateurs monotones sur un treillis, analyse sémantique de programmes. Thèse d’état ès sciences mathématiques. Université scientifique et médicale de Grenoble, Grenoble, France. Retrieved from https://tel.archives-ouvertes.fr/tel-00288657/document.Google ScholarGoogle Scholar
  7. [7] Demange Delphine, Pichardie David, and Stefanesco Léo. 2015. Verifying fast and sparse SSA-based optimizations in Coq. In Proceedings of the Compiler Construction.Franke Björn (Ed.), Lecture Notes in Computer Science, Vol. 9031, Springer, 233252. DOI:Google ScholarGoogle ScholarCross RefCross Ref
  8. [8] Falk Heiko, Altmeyer Sebastian, Hellinckx Peter, Lisper Björn, Puffitsch Wolfgang, Rochange Christine, Schoeberl Martin, Sørensen Rasmus Bo, Wägemann Peter, and Wegener Simon. 2016. TACLeBench: A benchmark collection to support worst-case execution time research. In Proceedings of the 16th International Workshop on Worst-Case Execution Time Analysis andOpenAccess Series in Informatics.Schoeberl Martin (Ed.), Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 2:1–2:10.Google ScholarGoogle Scholar
  9. [9] França Ricardo Bedin, Favre-Felix Denis, Leroy Xavier, Pantel Marc, and Souyris Jean. 2011. Towards formally verified optimizing compilation in flight control software. In Proceedings of the Bringing Theory to Practice: Predictability and Performance in Embedded Systems.Lucas Philipp, Thiele Lothar, Triquet Benoit, Ungerer Theo, and Wilhelm Reinhard (Eds.), Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, Germany, 5968. DOI:Google ScholarGoogle ScholarCross RefCross Ref
  10. [10] Kästner Daniel, Barrho Jörg, Wünsche Ulrich, Schlickling Marc, Schommer Bernhard, Schmidt Michael, Ferdinand Christian, Leroy Xavier, and Blazy Sandrine. 2018. CompCert: Practical experience on integrating and qualifying a formally verified optimizing compiler. In Proceedings of the ERTS2 2018-9th European Congress Embedded Real-Time Software and Systems. 19. Retrieved from https://hal.inria.fr/hal-01643290.Google ScholarGoogle Scholar
  11. [11] Kildall Gary Arlen. 1973. A unified approach to global program optimization. In Proceedings of the Principles of Programming Languages (Boston, Massachusetts). Association for Computing Machinery, New York, NY, 194206. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. [12] Leroy Xavier. 2009. Formal verification of a realistic compiler. Communications of the ACM 52, 7 (2009), 107–115.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. [13] Leroy Xavier. 2009. A formally verified compiler back-end. Journal of Automated Reasoning 43, 4 (2009), 363446. Retrieved from http://xavierleroy.org/publi/compcert-backend.pdf.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. [14] Monniaux David and Boulmé Sylvain. 2022. The trusted computing base of the CompCert verified compiler. In Proceedings of the Programming Languages and Systems.Springer, 204233. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. [15] Rastello Fabrice (Ed.). 2016. SSA-based Compiler Design. Springer. An updated version is available from http://ssabook.gforge.inria.fr/latest/book.pdf.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. [16] Sewell Thomas Arthur Leck, Myreen Magnus O., and Klein Gerwin. 2013. Translation validation for a verified OS kernel. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation.Boehm Hans-Juergen and Flanagan Cormac (Eds.), ACM, 471482. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. [17] Six Cyril, Boulmé Sylvain, and Monniaux David. 2020. Certified and efficient instruction scheduling: Application to interlocked VLIW processors. Proceedings of the ACM on Programming Languages (2020). Retrieved from https://hal.archives-ouvertes.fr/hal-02185883. To appear.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. [18] Six Cyril, Gourdin Léo, Boulmé Sylvain, Monniaux David, Fasse Justus, and Nardino Nicolas. 2022. Formally verified superblock scheduling. In Proceedings of the Certified Programs and Proofs.Popescu Andrei and Zdancewic Steve (Eds.), ACM, 4054. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. [19] Tristan Jean-Baptiste. 2009. Formal Verification of Translation Validators. Ph. D. Dissertation. Paris Diderot University, France. Retrieved from https://tel.archives-ouvertes.fr/tel-00437582.Google ScholarGoogle Scholar
  20. [20] Tristan Jean-Baptiste and Leroy Xavier. 2009. Verified validation of lazy code motion. In Proceedings of the Programming Language Design and Implementation.Hind Michael and Diwan Amer (Eds.), ACM, 316326. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. [21] Yang Xuejun, Chen Yang, Eide Eric, and Regehr John. 2011. Finding and understanding bugs in C compilers. In Proceedings of the Programming Language Design and Implementation.ACM, 283294.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Formally Verified Loop-Invariant Code Motion and Assorted Optimizations

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM Transactions on Embedded Computing Systems
          ACM Transactions on Embedded Computing Systems  Volume 22, Issue 1
          January 2023
          512 pages
          ISSN:1539-9087
          EISSN:1558-3465
          DOI:10.1145/3567467
          • Editor:
          • Tulika Mitra
          Issue’s Table of Contents

          Publication rights licensed to ACM. ACM acknowledges that this contribution was authored or co-authored by an employee, contractor or affiliate of a national government. As such, the Government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only.

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 13 December 2022
          • Online AM: 7 April 2022
          • Accepted: 28 March 2022
          • Revised: 15 February 2022
          • Received: 15 October 2021
          Published in tecs Volume 22, Issue 1

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article
          • Refereed
        • Article Metrics

          • Downloads (Last 12 months)97
          • Downloads (Last 6 weeks)10

          Other Metrics

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader

        Full Text

        View this article in Full Text.

        View Full Text

        HTML Format

        View this article in HTML Format .

        View HTML Format
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!