void CumulativeRows(double *matrix) {
  matrix[1] += matrix[0];
  matrix[2] += matrix[1];
  matrix[3] += matrix[2];
  matrix[5] += matrix[4];
  matrix[6] += matrix[5];
  matrix[7] += matrix[6];
  matrix[9] += matrix[8];
  matrix[10] += matrix[9];
  matrix[11] += matrix[10];
  matrix[13] += matrix[12];
  matrix[14] += matrix[13];
  matrix[15] += matrix[14];
}


x86 assembly (clang, -O0):
<CumulativeRows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x28(%rax),%xmm0
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x30(%rax),%xmm0
movsd  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x38(%rax),%xmm0
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x48(%rax),%xmm0
movsd  %xmm0,0x48(%rax)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x50(%rax),%xmm0
movsd  %xmm0,0x50(%rax)
mov    -0x8(%rbp),%rax
movsd  0x50(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x58(%rax),%xmm0
movsd  %xmm0,0x58(%rax)
mov    -0x8(%rbp),%rax
movsd  0x60(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x68(%rax),%xmm0
movsd  %xmm0,0x68(%rax)
mov    -0x8(%rbp),%rax
movsd  0x68(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x70(%rax),%xmm0
movsd  %xmm0,0x70(%rax)
mov    -0x8(%rbp),%rax
movsd  0x70(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x78(%rax),%xmm0
movsd  %xmm0,0x78(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CumulativeRows>:
movsd  (%rdi),%xmm0
addsd  0x8(%rdi),%xmm0
movsd  0x20(%rdi),%xmm1
movsd  %xmm0,0x8(%rdi)
addsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x10(%rdi)
addsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x18(%rdi)
addsd  0x28(%rdi),%xmm1
movsd  %xmm1,0x28(%rdi)
addsd  0x30(%rdi),%xmm1
movsd  %xmm1,0x30(%rdi)
addsd  0x38(%rdi),%xmm1
movsd  %xmm1,0x38(%rdi)
movsd  0x40(%rdi),%xmm0
addsd  0x48(%rdi),%xmm0
movsd  %xmm0,0x48(%rdi)
addsd  0x50(%rdi),%xmm0
movsd  %xmm0,0x50(%rdi)
addsd  0x58(%rdi),%xmm0
movsd  %xmm0,0x58(%rdi)
movsd  0x60(%rdi),%xmm0
addsd  0x68(%rdi),%xmm0
movsd  %xmm0,0x68(%rdi)
addsd  0x70(%rdi),%xmm0
movsd  %xmm0,0x70(%rdi)
addsd  0x78(%rdi),%xmm0
movsd  %xmm0,0x78(%rdi)
ret

LLVM IR (-O0):
define void @CumulativeRows(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = fadd double %8, %5
store double %9, double* %7
%10 = load double*, double** %2
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %2
%14 = getelementptr inbounds double, double* %13, i64 2
%15 = load double, double* %14
%16 = fadd double %15, %12
store double %16, double* %14
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = load double*, double** %2
%21 = getelementptr inbounds double, double* %20, i64 3
%22 = load double, double* %21
%23 = fadd double %22, %19
store double %23, double* %21
%24 = load double*, double** %2
%25 = getelementptr inbounds double, double* %24, i64 4
%26 = load double, double* %25
%27 = load double*, double** %2
%28 = getelementptr inbounds double, double* %27, i64 5
%29 = load double, double* %28
%30 = fadd double %29, %26
store double %30, double* %28
%31 = load double*, double** %2
%32 = getelementptr inbounds double, double* %31, i64 5
%33 = load double, double* %32
%34 = load double*, double** %2
%35 = getelementptr inbounds double, double* %34, i64 6
%36 = load double, double* %35
%37 = fadd double %36, %33
store double %37, double* %35
%38 = load double*, double** %2
%39 = getelementptr inbounds double, double* %38, i64 6
%40 = load double, double* %39
%41 = load double*, double** %2
%42 = getelementptr inbounds double, double* %41, i64 7
%43 = load double, double* %42
%44 = fadd double %43, %40
store double %44, double* %42
%45 = load double*, double** %2
%46 = getelementptr inbounds double, double* %45, i64 8
%47 = load double, double* %46
%48 = load double*, double** %2
%49 = getelementptr inbounds double, double* %48, i64 9
%50 = load double, double* %49
%51 = fadd double %50, %47
store double %51, double* %49
%52 = load double*, double** %2
%53 = getelementptr inbounds double, double* %52, i64 9
%54 = load double, double* %53
%55 = load double*, double** %2
%56 = getelementptr inbounds double, double* %55, i64 10
%57 = load double, double* %56
%58 = fadd double %57, %54
store double %58, double* %56
%59 = load double*, double** %2
%60 = getelementptr inbounds double, double* %59, i64 10
%61 = load double, double* %60
%62 = load double*, double** %2
%63 = getelementptr inbounds double, double* %62, i64 11
%64 = load double, double* %63
%65 = fadd double %64, %61
store double %65, double* %63
%66 = load double*, double** %2
%67 = getelementptr inbounds double, double* %66, i64 12
%68 = load double, double* %67
%69 = load double*, double** %2
%70 = getelementptr inbounds double, double* %69, i64 13
%71 = load double, double* %70
%72 = fadd double %71, %68
store double %72, double* %70
%73 = load double*, double** %2
%74 = getelementptr inbounds double, double* %73, i64 13
%75 = load double, double* %74
%76 = load double*, double** %2
%77 = getelementptr inbounds double, double* %76, i64 14
%78 = load double, double* %77
%79 = fadd double %78, %75
store double %79, double* %77
%80 = load double*, double** %2
%81 = getelementptr inbounds double, double* %80, i64 14
%82 = load double, double* %81
%83 = load double*, double** %2
%84 = getelementptr inbounds double, double* %83, i64 15
%85 = load double, double* %84
%86 = fadd double %85, %82
store double %86, double* %84
ret void
}

LLVM IR (-O2):
define void @CumulativeRows(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fadd double %2, %4
store double %5, double* %3
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fadd double %5, %7
store double %8, double* %6
%9 = getelementptr inbounds double, double* %0, i64 3
%10 = load double, double* %9
%11 = fadd double %8, %10
store double %11, double* %9
%12 = getelementptr inbounds double, double* %0, i64 4
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %0, i64 5
%15 = load double, double* %14
%16 = fadd double %13, %15
store double %16, double* %14
%17 = getelementptr inbounds double, double* %0, i64 6
%18 = load double, double* %17
%19 = fadd double %16, %18
store double %19, double* %17
%20 = getelementptr inbounds double, double* %0, i64 7
%21 = load double, double* %20
%22 = fadd double %19, %21
store double %22, double* %20
%23 = getelementptr inbounds double, double* %0, i64 8
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %0, i64 9
%26 = load double, double* %25
%27 = fadd double %24, %26
store double %27, double* %25
%28 = getelementptr inbounds double, double* %0, i64 10
%29 = load double, double* %28
%30 = fadd double %27, %29
store double %30, double* %28
%31 = getelementptr inbounds double, double* %0, i64 11
%32 = load double, double* %31
%33 = fadd double %30, %32
store double %33, double* %31
%34 = getelementptr inbounds double, double* %0, i64 12
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %0, i64 13
%37 = load double, double* %36
%38 = fadd double %35, %37
store double %38, double* %36
%39 = getelementptr inbounds double, double* %0, i64 14
%40 = load double, double* %39
%41 = fadd double %38, %40
store double %41, double* %39
%42 = getelementptr inbounds double, double* %0, i64 15
%43 = load double, double* %42
%44 = fadd double %41, %43
store double %44, double* %42
ret void
}