On Tue, Aug 01, 2017 at 07:08:41AM -0400, Eric Gallager wrote:
> > Heh.  I suspect -Os would benefit from a separate compilation pipeline
> > such as -Og.  Nowadays the early optimization pipeline is what you
> > want (mostly simple CSE & jump optimizations, focused on code
> > size improvements).  That doesn't get you any loop optimizations but
> > loop optimizations always have the chance to increase code size
> > or register pressure.
> >
> 
> Maybe in addition to the -Os optimization level, GCC mainline could
> also add the -Oz optimization level like Apple's GCC had, and clang
> still has? Basically -Os is -O2 with additional code size focus,
> whereas -Oz is -O0 with the same code size focus. Adding it to the
> FSF's GCC, too, could help reduce code size even further than -Os
> currently does.

No, lack of optimizations certainly doesn't reduce the code size.
For small code, you need lots of optimizations, but preferrably code-size
aware ones.  For RTL that is usually easier, because you can often compare
the sizes of the old and new sequences and choose smaller, for GIMPLE
optimizations it is often just a wild guess on what optimizations generally
result in smaller and what optimizations generally result in larger code.
There are too many following passes to know for sure, and finding the right
heuristics is hard.

        Jakub

Reply via email to