GATE / CS ARCHIVE

GATE CSE 2014 SET 1 / QUESTION 17

GATE CSE 2014 Set 1 Q17

Compiler Design · Code Optimization & Data-Flow Analysis · Full GATE CSE 2014 Set 1 paper

GATE 2014 Set 1, Q17 1 mark · MCQ
Report issue

Code Optimization & Data-Flow Analysis

Question 17, GATE 2014: Which compiler statement is false? A: A basic block is entered at its beginning and exited at its end. B: Available-expression analysis supports common-subexpression elimination. C: Live-variable analysis supports dead-code elimination. D: Replacing x=4*5 by x=20 is common-subexpression elimination.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. Method and setup. Common-subexpression elimination reuses a previously computed expression whose operands have not changed. Here no prior computation is being reused: a constant expression is evaluated during compilation. Available-expression and liveness analyses instead answer whether a value is reusable and whether a computed result will be needed.

2. Work through the result and its assumptions. Replacing the compile-time arithmetic 4×5 by 20 is constant folding, not common-subexpression elimination. The other statements describe standard basic-block and dataflow uses. Thus the false statement is D.

Original paper, page 11 · Answer key