Questions: Static Single Assignment (SSA) Form

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Why does constant propagation become dramatically simpler when the IR is in SSA form?

ASSA restricts programs to integer types, so all values are known statically at compile time
BEach use has exactly one reaching definition, so if x₃ = 5, every use of x₃ can immediately be replaced with 5 without any iterative dataflow analysis
CPhi functions pre-compute all possible values at control flow joins, making constants visible in a single pass
DSSA eliminates all conditional branches, so values are always statically determined
Question 2 Multiple Choice

A program contains: if (cond) { x = 1; } else { x = 2; } followed by: y = x + 3. After converting to SSA form, what appears at the join point after the if-else?

ATwo separate assignments x = 1 and x = 2 are duplicated at the join point and resolved by runtime branching
BA phi function x₃ = φ(x₁, x₂) is placed at the join point, which resolves to x₁ or x₂ depending on which branch was taken
CA merged assignment x₃ = (x₁ + x₂) / 2 representing the average of both branches
DThe variable x is left undefined at the join point; SSA requires the programmer to initialize it before use
Question 3 True / False

Phi functions in SSA form are real instructions that execute at runtime to select between multiple possible values.

TTrue
FFalse
Question 4 True / False

In SSA form, any given variable name may appear on the left-hand side of at most one assignment anywhere in the entire function.

TTrue
FFalse
Question 5 Short Answer

Explain why phi functions are necessary in SSA form and how the dominance frontier determines where they are placed.

Think about your answer, then reveal below.