5 questions to test your understanding
A compiler applies strength reduction to the loop `for (i=0; i<n; i++) a[i] = 0;`. Which transformation best describes what happens to the address calculation `base + i * element_size`?
A student claims that array subscript optimization changes which memory locations are accessed in order to improve performance. Is this correct?
Strength reduction can be applied to `a[b[i]]` when `b[i]` is known to be monotonically increasing.
In a doubly-nested loop accessing `a[i][j]`, strength reduction can eliminate both the outer and inner multiplications by maintaining a separate pointer for each loop level.
Why is array subscript optimization especially important for dense linear algebra code rather than for code with irregular access patterns?