– 20 – Removing Aliasing Scalar replacement: Copy array elements that are reused into temporary variables Assumes no memory aliasing (otherwise possibly incorrect) # sum_rows2 inner loop.L66: addsd(%rcx), %xmm0 # FP Add addq$8, %rcx decq%rax jne.L66 /* Sums rows of n x n matrix a and stores in vector b */ void sum_rows2(double *a, double *b, long n) { long i, j; for (i = 0; i < n; i++) { double val = 0; for (j = 0; j < n; j++) val += a[i*n + j]; b[i] = val; }
{}