GATE Computer ScienceVery hardGATE CS (PYQ pattern)

For 1: a = 0; 2: if p > 0 goto L2; 3: L1: a = a + 1; 4: if a < m goto L1; 5: goto L3; 6: L2: b = 1; 7: if q > 0 goto L1; 8: L3: return a, consider the block B that starts at L1 (statements 3–4). What is its dominance frontier DF(B)?

  1. A. {the L3 block}
  2. B. {the L1 block}
  3. C. {the L1 block, the L3 block}
  4. D. {the L2 block, the L3 block}

Correct answer: C. {the L1 block, the L3 block}

L1 is entered from the entry block and from L2, so its idom is the entry block. B has a self-loop (4 → L1): B is a predecessor of B and does not strictly dominate it, so B ∈ DF(B). B also reaches L3 through {5}, and L3 is entered from L2 too, so B does not dominate L3: L3 ∈ DF(B). {5} is dominated by B, so it is not in the frontier.

More Compiler Design questions

Exams that ask this topic