GATE CS 2025 Set 1 | Question 13

MCQ · 1 mark · −0.33

Which ONE of the following techniques used in compiler code optimization uses live variable analysis?

  1. Option A: Run-time function call management
  2. Option B: Register assignment to variables (correct)
  3. Option C: Strength reduction
  4. Option D: Constant folding

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