3 ms·
For sure. Consider idiom recognition, where a compiler takes a series of operations that implement some operation that isn't expressible as a language primitiv
by BeeOnRope 8y ago
For sure.
Consider idiom recognition, where a compiler takes a series of operations that implement some operation that isn't expressible as a language primitive and turns it into a single machine instruction that performs that operation. Rotate built up from a couple of shifts for example.
Consider auto-vectorization for which the language has no direct support.
Consider inlining and value-propagation and all the simplification can that occur when you combine them.
Basically compile any non-trivial C program without optimization (or without some interesting optimization option) and with optimization, and look at the assembly. In many cases you wouldn't be able to write C code at all to reproduce the optimized version with the not-optimizing compiler. In other cases you could, but at the cost of code duplication or other things that would reduce the quality of your code.