Will It Optimize?
It is tempting to think of compiler optimizations as reducing the constant in your program’s big-O complexity, and nothing else. They aren’t supposed to be able to make your program asymptotically faster, or affect its output.
Naturally, he has some interesting counterexamples from GCC.