Project ForgeSign up free
Compiler Design
Code Generation & Optimization
GATE 2014
Medium

Which one of the following is FALSE?

  • AA basic block is a sequence of instructions where control enters the sequence at the beginning and exits at the end.
  • BAvailable expression analysis can be used for common subexpression elimination.
  • CLive variable analysis can be used for dead code elimination.
  • x = 4*5 ⇒ x = 20 is an example of common subexpression elimination.

Explanation

A, B, and C are all standard, correct compiler-optimization facts. D mislabels the optimization: replacing 'x=4*5' with 'x=20' (evaluating a constant expression at compile time) is CONSTANT FOLDING, not common subexpression elimination (which reuses an already-computed value for a repeated expression).

Source: GATE CS 2014 (Session 1) (2014)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free