[LLVMdev] function inlining

Jochen Wilhelmy j.wilhelmy at arcor.de
Tue Feb 2 10:06:29 PST 2010


> There's the "always inline" function attribute.
>    
Is it right that I have to create an AttrListPtr, call addAttr(~0, 
Attribute::AlwaysInline) on
it and set it to the function?

> However, the function can't be inlined unless its containing module is
> linked to the calling module and the result optimized... inlining
> requires copying the body of one function into another, and you need
> both function bodies for that.  Now if the modules are linked together
> and then optimized, a single-instruction function is overwhelmingly
> likely to be inlined into its callers under standard inlining
> heuristics, so you don't really need to do anything to force this
> particular function to be inlined beyond making it possible by linking
> the modules together.
>    
Yes, I already link them together. How do I run an inline pass?

-Jochen




More information about the llvm-dev mailing list