I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought up ever.
Can a CPU do this? What are the trade-offs in designing a CPU that detects +1, *1 and *0 and executes them faster?