Looks like constant folding to me. What’s the difference exactly?
In-place updating means you re-use the memory location of an earlier variable that's not needed anymore. Simple example in pseudo-C:
BigInt increment_twice(const BigInt x) {
const BigInt y = x + 1;
const BigInt z = y + 1;
return z;
}
There are no compile-time constant expressions that could be folded here. But since y is not used after z is assigned, we can re-use the memory location of y for the memory location of z.And if the caller is not using the argument after the function returns, the memory location of the argument can be used to store the return value. This means the function call does not need to allocate memory at all, not even on the stack.