GATE 2016 CS – Question 29
Consider the following code segment.
x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;The minimum number of *total* variables required to convert the above code segment to *static single assignment* form is ________.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 10
Explanation
In static single assignment form every variable is assigned only once. The five assignments need five new variables: $x_1 = u - t$, $y_1 = x_1 * v$, $x_2 = y_1 + w$, $y_2 = t - z$ and $y_3 = x_2 * y_2$. The inputs $u, t, v, w, z$ are also variables, so the total is $5 + 5 = 10$.