[LLVMdev] Inline hints for *compiler clients*

Chris Lattner sabre at nondot.org
Wed Mar 15 09:15:53 PST 2006

On Wed, 15 Mar 2006, Vikram S. Adve wrote:
>> Why can't the compiler pass just call InlineFunction(CallSite) on the 
>> callsite it wants inlined?  The only way that can fail is if LLVM cannot 
>> ever inline the call (e.g. it uses varargs).

> In some cases, that would be fine.  But in other cases:
> (1) It cannot "un-inline" any function that was previously inlined.

I'm not following.  Why do you want to uninline stuff?  If we had a 'never 
inline these functions' list, a transformation could add any function it 
wants to this list to prevent the inliner from inlining it in the future.

Aside from that, I don't see what uninlining has to do with inlining 
heuristics, can you explain a bit more?

> (2) It requires writing a driver loop nest to go over all call sites and 
> decide what to do.  If all you want is to influence the existing heuristics, 
> that seems like too much work.

You're talking about something like 5 lines of code, plus the predicate 
deciding whether to inline it or not (which you'd need anyway).

> (3) If multiple passes want such control, this would end up duplicating the 
> driver code.

Again, this is a trivial amount of code.  Giving passes the ability to 
modify the heuristics used by the inliner would significantly dwarf this 
in both amount of code and complexity.

What are you really trying to do here?  Can you provide an example?



More information about the llvm-dev mailing list