GateAI
Data Flow Analyses

GATE CSE 2026 Set 1 · Q42

MCQ2 marksMedium

Time

Consider the control flow graph shown in the figure. Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5? *Note:* All the variables are integers.

GATE CSE 2026 Set 1 Q42 diagram

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) B4: { g * k } B5: { }

Data Flow Analyses

To find redundant expressions (common subexpressions) in basic blocks B4 and B5, we perform Available Expressions Analysis:

  1. Basic Block B1:

    • Generates: b+ib + i

    • Out(B1)={b+i}\text{Out}(B1) = \{ b + i \}

  2. Basic Block B2:

    • Computes: g∗kg * k

    • Does not kill b+ib + i (neither bb nor ii is modified).

    • Out(B2)={b+i,g∗k}\text{Out}(B2) = \{ b + i, g * k \}

  3. Basic Block B3:

    • Computes: g∗kg * k

    • Computes: c+mc + m, but also assigns to bb (b=c+mb = c + m), which kills the expression b+ib + i.

    • Out(B3)={g∗k,c+m}\text{Out}(B3) = \{ g * k, c + m \}

  4. At the entry of Basic Block B4:

    In(B4)=Out(B2)∩Out(B3)={b+i,g∗k}∩{g∗k,c+m}={g∗k}\text{In}(B4) = \text{Out}(B2) \cap \text{Out}(B3) = \{ b + i, g * k \} \cap \{ g * k, c + m \} = \{ g * k \}
    • Inside B4:

      • The expression g∗kg * k in x=g∗kx = g * k is already available from all incoming paths ({g∗k}∈In(B4)\{ g * k \} \in \text{In}(B4)), so **g∗kg * k is a redundant common subexpression**.

      • The expression b+ib + i in y=b+iy = b + i is NOT available because it was killed along the path through B3.

    • Redundant expressions in **B4 = {g∗k}\{ g * k \}**.

  5. At the entry of Basic Block B5:

    • B4 generates b+ib + i, so Out(B4)={g∗k,b+i}\text{Out}(B4) = \{ g * k, b + i \}.

    • In(B5)=Out(B4)={g∗k,b+i}\text{In}(B5) = \text{Out}(B4) = \{ g * k, b + i \}.

    • Inside B5, the expression evaluated is c+mc + m. Since c+m∉In(B5)c + m \notin \text{In}(B5), it is not redundant.

    • Redundant expressions in B5 = {}\{ \}.

Thus, the correct option is (D).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Data Flow Analyses previous year question is Q42 of the GATE CSE 2026 Set 1 paper. Find more GATE CSE PYQs on Data Flow Analyses in Compiler Design, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Data Flow Analyses PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Data Flow Analyses in GATE CSE

Data Flow Analyses has 8 GATE CSE PYQs across 8 papers from 2014 to 2026. 5 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2026 Set 1.

How GATE tests Data Flow Analyses

More from GATE CSE 2026 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2026 Set 1 · Q42 · MCQ

Consider the control flow graph shown in the figure. Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5? *Note:* All the variables are integers.

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.