Semantic reasoning about the sea of nodes

The Sea of Nodes intermediate representation was introduced by Cliff Click in the mid 90s as an enhanced Static Single Assignment (SSA) form. It improves on the initial SSA form by relaxing the total order on instructions in basic blocks into explicit data and control dependencies. This makes programs more flexible to optimize. This graph-based representation is now used in many industrial-strength compilers, such as HotSpot or Graal. While the SSA form is now well understood from a semantic perspective -- even formally verified optimizing compilers use it in their middle-end -- very few semantic studies have been conducted about the Sea of Nodes. This paper presents a simple but rigorous formal semantics for a Sea of Nodes form. It comprises a denotational component to express data computation, and an operational component to express control flow. We then prove a fundamental, dominance-based semantic property on Sea of Nodes programs which determines the regions of the graph where the values of nodes are preserved. Finally, we apply our results to prove the semantic correctness of a redundant zero-check elimination optimization. All the necessary semantic properties have been mechanically verified in the Coq proof assistant.

[1]  Cliff Click,et al.  Global code motion/global value numbering , 1995, PLDI '95.

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

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

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

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

[6]  Toshio Nakatani,et al.  Effective null pointer check elimination utilizing hardware trap , 2000, SIGP.

[7]  Sebastian Buchwald,et al.  Verified construction of static single assignment form , 2016, CC.

[8]  Hanspeter Mössenböck,et al.  An intermediate representation for speculative optimizations in a dynamic compiler , 2013, VMIL '13.

[9]  Sebastian Buchwald,et al.  Simple and Efficient Construction of Static Single Assignment Form , 2013, CC.

[10]  Alan Mycroft,et al.  Combined Code Motion and Register Allocation Using the Value State Dependence Graph , 2003, CC.

[11]  Jianzhou Zhao Formalizing the SSA-based compiler for verified advanced program transformations , 2013 .

[12]  Sebastian Buchwald,et al.  FIRM—A Graph-Based Intermediate Representation , 2011 .

[13]  Sabine Glesner,et al.  Optimizing Code Generation from SSA Form: A Comparison Between Two Formal Correctness Proofs in Isabelle/HOL , 2005, COCV@ETAPS.

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

[15]  Cliff Click,et al.  A Simple Graph-Based Intermediate Representation , 1995, Intermediate Representations Workshop.

[16]  Benoît Dupont de Dinechin Using the SSA-Form in a Code Generator , 2014, CC.

[17]  Delphine Demange,et al.  Mechanizing conventional SSA for a verified destruction with coalescing , 2016, CC.

[18]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.

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

[20]  Keith D. Cooper,et al.  Combining analyses, combining optimizations , 1995, TOPL.