The Java compiler almost does ZERO optimizations.
So you really want to you should ask why the JIT rather than compiler does optimizations in Java?