[cfe-dev] always_inline and noinline attributes

Matthijs Kooijman matthijs at stdin.nl
Fri Jul 18 14:09:28 PDT 2008

Hi Devang,

> The correct approach is to encode these function properties in LLVM IR. 
> Stay tuned, I'll send out proposal on LLVM dev list in next few days.
Any chance of this proposal getting finished? :-)

> Once the information is encoded in the IR, the remaining issue is how to 
> invoke the LLVM inlining pass when at least one function is marked as 
> always_inline. There are two possible approaches:
> 1) Teach FE tools (e.g. clang, llvm-gcc) to insert inlining pass in the 
> PassManager while requesting (opt + code generation) when it least one 
> function with attribute always_inline is seen.
Perhaps there could be a specific inliner that does only this? This prevents
surprises when people didn't expect inlining?

> 2) Teach the LLVM PassManager to sniff always_inline property encoded in 
> the LLVM IR and do the right thing.
This sounds like it might also surprise people, if they only add a single pass
and still things are inlined. Might not be a big problem, though.

Another reason why I think encoding in the IR is necessary: If I have an
always inline function defined in one module and referenced in another, I
think it should still be inlined after I link the two modules together, right?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080718/2932c2b8/attachment.sig>

More information about the cfe-dev mailing list