Skip to main content

Validating Dominator Trees for a Fast, Verified Dominance Test

  • Conference paper
  • First Online:
Interactive Theorem Proving (ITP 2015)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9236))

Included in the following conference series:

Abstract

The problem of computing dominators in a control flow graph is central to numerous modern compiler optimizations. Many efficient algorithms have been proposed in the literature, but mechanizing the correctness of the most sophisticated algorithms is still considered as too hard problems, and to this date, verified compilers use less optimized implementations. In contrast, production compilers, like GCC or LLVM, implement the classic, efficient Lengauer-Tarjan algorithm [12], to compute dominator trees. And subsequent optimization phases can then determine whether a CFG node dominates another node in constant time by using their respective depth-first search numbers in the dominator tree. In this work, we aim at integrating such techniques in verified compilers. We present a formally verified validator of untrusted dominator trees, on top of which we implement and prove correct a fast dominance test following these principles. We conduct our formal development in the Coq proof assistant, and integrate it in the middle-end of the CompCertSSA verified compiler. We also provide experimental results showing performance improvement over previous formalizations.

This work was supported by Agence Nationale de la Recherche, grant number ANR-14-CE28-0004 DISCOVER.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Such a property would be required to prove completeness: if a node d dominates a node n then the dominance test on (dn) should succeed. To our experience in verified compilation, we never make usage of such a completeness property. The property holds, but we do not need to prove it in Coq.

  2. 2.

    Not to be confused with the control flow graph here.

  3. 3.
    figure am

    is a dictionary implementation using Patricia trees provided in CompCert. Type \(\mathtt {(Ptree.t~a)}\) denotes an associative, partial map with keys of type \(\mathtt {positive}\) – binary encoding of strictly positive integers – with associated data of type \(\mathtt {a}\). In this paper, types \(\mathtt {node}\) and \(\mathtt {positive}\) are synonyms.

  4. 4.

    We write m!n the lookup of a key

    figure aq

    in a map

    figure ar

    .

  5. 5.

    Recall that we rely on the standard implementation of positive integers,

    figure cm

    .

  6. 6.

    The impact of building and using the dominance test is currently negligible compared to the whole compilation time, as, currently, certain compiler passes (such as the SSA deconstruction) would need performance improvement.

References

  1. Allen, F.E., Cocke, J.: Graph theoretic constructs for program control flow analysis. Technical report, IBM T.J. Watson Research Center (1972)

    Google Scholar 

  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)

    Article  Google Scholar 

  3. Chlipala, A.: A verified compiler for an impure functional language. In: POPL 2010, pp. 93–106. ACM (2010)

    Google Scholar 

  4. Cooper, K.D., Harvey, T.J., Kennedy, K.: A simple, fast dominance algorithm. Technical report, Rice University (2006)

    Google Scholar 

  5. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM TOPLAS 13(4), 451–490 (1991)

    Article  Google Scholar 

  6. Dargaye, Z., Leroy, X.: Mechanized verification of CPS transformations. In: Dershowitz, N., Voronkov, A. (eds.) LPAR 2007. LNCS (LNAI), vol. 4790, pp. 211–225. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  7. Demange, D., Pichardie, D., Stefanesco, L.: Verifying fast and sparse SSA-based optimizations in Coq. In: Franke, B. (ed.) CC 2015. LNCS, vol. 9031, pp. 233–252. Springer, Heidelberg (2015)

    Chapter  Google Scholar 

  8. Fluet, M., Weeks, S.: Contification using dominators. In: Proceedings of ICFP 2001, pp. 2–13. ACM (2001)

    Google Scholar 

  9. Georgiadis, L., Laura, L., Parotsidis, N., Tarjan, R.E.: Dominator certification and independent spanning trees: an experimental study. In: Demetrescu, C., Marchetti-Spaccamela, A., Bonifaci, V. (eds.) SEA 2013. LNCS, vol. 7933, pp. 284–295. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  10. Georgiadis, L., Tarjan, R.E., Werneck, R.F.: Finding dominators in practice. J. Graph Algorithms Appl. 10(1), 69–94 (2006)

    Article  MATH  MathSciNet  Google Scholar 

  11. Georgiadis, L., Tarjan, R.E.: Dominator tree verification and vertex-disjoint paths. In: Proceedings of SODA 2005, pp. 433–442. ACM (2005)

    Google Scholar 

  12. Lengauer, T., Tarjan, R.E.: A fast algorithm for finding dominators in a flowgraph. ACM TOPLAS 1(1), 121–141 (1979)

    Article  MATH  Google Scholar 

  13. Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)

    Article  Google Scholar 

  14. Leroy, X.: A formally verified compiler back-end. JAR 43(4), 363–446 (2009)

    Article  MATH  MathSciNet  Google Scholar 

  15. Okasaki, C., Gill, A.: Fast mergeable integer maps. In: Workshop on ML, pp. 77–86 (1998)

    Google Scholar 

  16. Parotsidis, N., Georgiadis, L.: Dominators in directed graphs: a survey of recent results, applications, and open problems. In: 2nd International Symposium on Computing in Informatics and Mathematics (ISCIM 2013), vol. 1, pp. 15–20. Epoka University (2013)

    Google Scholar 

  17. Rivest, R.L., Cormen, T.H., Leiserson, C.E., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press, Cambridge (2009)

    MATH  Google Scholar 

  18. Zhao, J., Nagarakatte, S., Martin, M., Zdancewic, S.: Formal verification of SSA-based optimizations for LLVM. In: PLDI 2013, pp. 175–186. ACM (2013)

    Google Scholar 

  19. Zhao, J., Zdancewic, S.: Mechanized verification of computing dominators for formalizing compilers. In: Hawblitzel, C., Miller, D. (eds.) CPP 2012. LNCS, vol. 7679, pp. 27–42. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  20. Zhao, J., Zdancewic, S., Nagarakatte, S., Martin, M.: Formalizing the LLVM intermediate representation for verified program transformation. In: POPL 2012, pp. 427–440. ACM (2012)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Sandrine Blazy , Delphine Demange or David Pichardie .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Blazy, S., Demange, D., Pichardie, D. (2015). Validating Dominator Trees for a Fast, Verified Dominance Test. In: Urban, C., Zhang, X. (eds) Interactive Theorem Proving. ITP 2015. Lecture Notes in Computer Science(), vol 9236. Springer, Cham. https://doi.org/10.1007/978-3-319-22102-1_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-22102-1_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-22101-4

  • Online ISBN: 978-3-319-22102-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics