4 ms·
What optimizer would remove the increment/decrement if the value was accessed in between? That seems like something that would be really easy to detect. I’ve n
by ses1984 2y ago
What optimizer would remove the increment/decrement if the value was accessed in between? That seems like something that would be really easy to detect.
I’ve never studied compilers though.
- remexre 2y agoIt would be very normal for a compiler to do an increment (or merge it into a later instruction), but never do the decrement, and instead use the old copy of the value.
- WJW 2y agoThen in the next step, it would see that the result of the increment is never used and thus the increment instruction is dead code and can also be removed.