Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Answer
(B)
Explanation
A variable is live at a point if its current value may still be read later, before it is overwritten; live variable analysis works this out for every point of the program. Register allocation needs exactly this: a register can be handed to another variable once its variable is dead, and two variables that are live at the same time cannot share a register. Strength reduction (cheaper operations on loop induction variables), constant folding (evaluating constant expressions at compile time) and run-time call management (activation records and calling sequences) do not depend on liveness.
Answer: B