[LLVMdev] Inlining in LLVM

Devang Patel dpatel at apple.com
Mon Oct 25 09:22:24 PDT 2010


On Oct 24, 2010, at 10:23 AM, J Nelson Amaral wrote:

> Duncan:
> 
> I am only superficially familiar with LLVM structure.
> 
> What I am trying to find out is if functions that have a single invocation are still found in the code during the compilation.
> 
> In Open64 and other compilers, there is an early inlining pass that inlines all procedures that have a single invocation site. The reasoning is that if there is a single call to a procedure, then there is not downside to inlining it.

There is not one but it is easy to write. LLVM inliner implementation is modular. It is easy to add new inliner based on your home grown heuristics.  InlineSimple is standard inliner tuned for the needs of general purpose optimizations. It can be run multiple times. InlineAlways is a very simple instance of special inliner where it only inlines functions that are marked as "always_inline". It would be very simple to write another special inliner for you needs. All you need to do is identify functions that have single call site. See InlineAlways.cpp for an example of a special inliner.

-
Devang
> 
> Does LLVM usually does that? Or would that be left to whatever front-end is being used? 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101025/980b4fa1/attachment.html>


More information about the llvm-dev mailing list