The GATE Grind

GATE 2014 CS (CS1) – Question 27

Compiler Design · Code Optimization and Data Flow Analysis · 1 mark · Multiple choice

Which compiler statement is FALSE?

  1. A basic block is a sequence entered at the beginning and exited at the end.
  2. Available-expression analysis can support common-subexpression elimination.
  3. Live-variable analysis can support dead-code elimination.
  4. Replacing x = 4 * 5 by x = 20 is common-subexpression elimination.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) Replacing x = 4 * 5 by x = 20 is common-subexpression elimination.

Explanation

Replacing4×5 by20 evaluates a constant expression at compile time and is constant folding. Common-subexpression elimination reuses an already computed expression instead of recomputing it. Therefore **D** is false; available expressions and liveness support the other optimisations described.