[LLVMdev] Optimization for size
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Oct 18 08:23:09 PDT 2011
On Oct 18, 2011, at 7:37 AM, Renato Golin wrote:
> On 17 October 2011 15:58, James Molloy <james.molloy at arm.com> wrote:
>> -Os doesn’t actually exist for llc, and I can’t see an obvious place where
>> that condition would be set. Where do we specify if we’re optimizing for
>> codesize or performance?
> The pass manager builder has an option for Os (0, 1, 2). But all it
> does, AFAICR, is to disable one explosive optimization pass.
In clang/LLVM, -Os is not very different from -O2. It dials back inlining, and disables a few other optimizations. The idea is to reduce code size without sacrificing too much performance.
The -Oz option is supposed to do the same as gcc's -Os: Minimize code size at any cost. This option is not supported by the code generator yet.
> I'm not sure how that gets propagated into the DAG. Maybe every
> function in that module receives the attribute Richard mentions...
Exactly. This is so you can mix -Os and -O3 code in an LTO build.
> Optimization for size hasn't been tested properly, at least not for
> ARM, and I hit all sorts of trouble (even before getting to DAG) when
> enabling it.
Bugzilla or it didn't happen.
More information about the llvm-dev