[LLVMdev] What are the equivalents of gcc inline control options like max-inline-insns-single in clang?

Chris Lattner clattner at apple.com
Sun Feb 20 10:44:54 PST 2011


On Feb 19, 2011, at 6:40 PM, Yuri wrote:

> On 02/19/2011 18:29, Chris Lattner wrote:
>> Clang doesn't expose any equivalent
> 
> Why not?

It's a policy decision.  These flags are not stable but users feel compelled to use them and then stick them in their makefiles.  We should aim to make the compiler "do the right thing" (e.g. with just -O2 and -O3) and make that be enough for people.

When people add flags like this to their makefiles, future changes in the compiler *pessimize* the code, because the old code tuned against a previous compiler is being built with *wrong* inline thresholds.

> Such controls are useful to tune the level of optimization. For example 
> from my experience forcing more inlining causes code to grow due to 
> resulting duplication but often such code is also faster. Even though 
> cache mishits may cause it to slow down too eventually. Speed is vital 
> for software in many industries.

I agree, we should just make the compiler faster without the flags.

> User should be able to force-flatten the module leaving only interface 
> functions.

The GCC folks have an __attribute__((flatten)) or something like that, which provides that.  This approach allows developers to express their goal, not a random number.

> On the other hand user may want to lower the inlining level 
> to speed up compilation.

They can build at -O2.

For compiler hackers, the opt/llc command line flags are exposed from clang/llvm-gcc with the -mllvm option.

-Chris



More information about the llvm-dev mailing list