And the other way around too. Even your C compiler can't reason about mutability, so it un-imperatives everything first:
int foo(int i, int j) {
while (i < 10) {
j += i;
i++;
}
return j;
}
That (j += i) line becomes: %9 = load i32, ptr %3, align 4, !dbg !23 // read i into %9
%10 = load i32, ptr %4, align 4, !dbg !25 // read j into %10
%11 = add nsw i32 %10, %9, !dbg !25 // sum %9 and %10 into %11
(i++;) becomes: %12 = load i32, ptr %3, align 4, !dbg !26 // read i into %12
%13 = add nsw i32 %12, 1, !dbg !26 // store i+1 into %13