The Denotational Semantics of SSA
Jad Elkhaleq Ghalayini, Neel Krishnaswami
TL;DR
The paper develops a rigorous, type-theoretic treatment of SSA variants by introducing $\lambda_{\mathsf{SSA}}$, an equational theory, and a categorical denotational semantics rooted in Freyd-Elgot categories. It proves soundness and completeness with respect to the denotational model and demonstrates the practical viability of the framework through concrete models, including a $TSO$-weak-memory construction, with substantial Lean formalization. By bridging SSA with a rich semantic foundation and providing algorithmic conversions between SSA, ANF, and strict SSA, the work enables compositional, law-governed reasoning about compiler optimizations and memory models. The results provide a scalable toolkit for verifying SSA-level transformations and memory-model correctness, with broad implications for compiler verification and programmable memory semantics.
Abstract
Static single assignment form, or SSA, has been the dominant compiler intermediate representation for decades. In this paper, we give a type theory for a variant of SSA, including its equational theory, which are strong enough to validate a variety of control and data flow transformations. We also give a categorical semantics for SSA, and show that the type theory is sound and complete with respect to the categorical axiomatization. We demonstrate the utility of our model by exhibiting a variety of concrete models satisfying our axioms, including in particular a model of TSO weak memory. The correctness of the syntactic metatheory, as well as the completeness proof has been mechanized in the Lean proof assistant.
