Static Single Assignment Theory

Static single assignment gives every version of a value one definition. Dominance frontiers identify where a value needs different incoming versions.

Source
Anbloq
Language
English
Created
Updated
Chapters
3
Reading time
1 min
In this article3 chapters
  1. Definitions and dominance
  2. A diamond needs a merge
  3. Renaming and data-flow precision

Definitions and dominance

A block dominates another if every path from the entry to that block passes through the first. In reachable code, the immediate dominators form a tree. A definition in SSA must dominate each ordinary use. A φ operand is an edge use, so the relevant dominance check is at the corresponding predecessor. This difference makes φ functions meaningful even though their operands may come from mutually exclusive paths.

Dominator trees express availability on every entry path. Phi functions reconcile the distinct incoming definitions, with an operand used specifically on its predecessor edge.

A diamond needs a merge

Suppose the two arms of a conditional assign versions \(x_1,x_2\) in blocks \(B_1,B_2\). After the merge, the value is defined by

\[ x_3=\phi(B_1:x_1,\ B_2:x_2). \]

The φ selects the incoming value of the edge actually taken. It is not a computation that evaluates both alternatives. A block lies in the dominance frontier of a definition block if it has a predecessor dominated by that block but is not strictly dominated by the block itself. The join in this diamond lies in both frontiers. Iterating the frontier accounts for new merge definitions and for loop-carried values.

Renaming and data-flow precision

After inserting φ nodes, traverse the dominator tree and keep the current version of each original variable. At each outgoing edge, record the version for the successor’s φ operand. Removing it on return from the subtree prevents one branch’s definition leaking into another. Pruned SSA avoids merges for values that are dead at the join. Explicit use–definition edges help equality saturation and superoptimization find candidate expressions, while a verified compiler must justify conversion and later destruction of the representation.[1]

References

  1. Ron Cytron et al., Efficiently Computing Static Single Assignment Form and the Control Dependence Graph ↩