Validating Dominator Trees for a Fast, Verified Dominance Test

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.

[1]  Robert E. Tarjan,et al.  A fast algorithm for finding dominators in a flowgraph , 1979, TOPL.

[2]  Robert E. Tarjan,et al.  Dominator tree verification and vertex-disjoint paths , 2005, SODA '05.

[3]  Santosh Nagarakatte,et al.  Formal verification of SSA-based optimizations for LLVM , 2013, PLDI.

[4]  Chris Okasaki,et al.  Fast Mergeable Integer Maps , 1998 .

[5]  Gilles Barthe,et al.  Formal Verification of an SSA-Based Middle-End for CompCert , 2014, TOPL.

[6]  Timothy J. Harvey,et al.  AS imple, Fast Dominance Algorithm , 1999 .

[7]  L. Georgiadis,et al.  Dominators in Directed Graphs : A Survey of Recent Results , Applications , and Open Problems , 2013 .

[8]  Robert E. Tarjan,et al.  Dominator Certification and Independent Spanning Trees: An Experimental Study , 2013, SEA.

[9]  Ken Kennedy,et al.  AS imple, Fast Dominance Algorithm , 1999 .

[10]  Ronald L. Rivest,et al.  Introduction to Algorithms, third edition , 2009 .

[11]  David Pichardie,et al.  Verifying Fast and Sparse SSA-Based Optimizations in Coq , 2015, CC.

[12]  Robert E. Tarjan,et al.  Finding Dominators in Practice , 2004, ESA.

[13]  Milo M. K. Martin,et al.  Formalizing the LLVM intermediate representation for verified program transformations , 2012, POPL '12.

[14]  Ronald L. Rivest,et al.  Introduction to Algorithms , 1990 .

[15]  Xavier Leroy,et al.  Formal verification of a realistic compiler , 2009, CACM.

[16]  Xavier Leroy,et al.  A Formally Verified Compiler Back-end , 2009, Journal of Automated Reasoning.

[17]  Adam Chlipala,et al.  A verified compiler for an impure functional language , 2010, POPL '10.

[18]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[19]  Xavier Leroy,et al.  Mechanized Verification of CPS Transformations , 2007, LPAR.

[20]  Stephen Weeks,et al.  Contification using dominators , 2001, ICFP '01.