> Can it turn x++,x++ into x+=2
For this particular example the line should be clear. If the variable is volatile, memory access can't be removed or reordered. If it's not volatile, everything is fair game.
Mandatory Godbolt link: https://godbolt.org/z/fjKs4hbjo