Subtopic 2 of 7
9.2Common subexpression elimination
If an expression was already computed and its operands have not changed, reuse the earlier value. Detected by the DAG or by available expressions analysis.
t1 = a + bcomputedc = t1 * 2t2 = a + bSAME expression, a and b unchangedd = t2 - c
4 instructions.
Previous year questions: Code Optimisation & Data-Flow (3)
PYQs are grouped by topic, so this is the full set for Code Optimisation & Data-Flow; try the ones that match this subtopic. Open all 3 on the topic page.