[LLVMdev] Inlining

Alastair Lynn arplynn at gmail.com
Sat Jan 9 08:35:29 PST 2010


Hi Duncan-

Forgive my confusion, but I can't help notice that LangRef states:

Globals with "linkonce" linkage are merged with other globals of the same name when linkage occurs. This is typically used to implement inline functions, templates, or other code which must be generated in each translation unit that uses it. Unreferenced linkonce globals are allowed to be discarded.

Why would linkonce be used to implement inline functions if it's not safe to inline linkonce functions?

Alastair

On 9 Jan 2010, at 08:15, Duncan Sands wrote:

> Hi Dustin,
> 
>> define linkonce fastcc i32 @foo(i32 %arg) alwaysinline
> 
> linkonce implies that the function body may change at link time.  Thus it would
> be wrong to inline it, since the code being inlined would not be the final code.
> Use linkonce_odr to tell the compiler that the function body can be replaced
> only by an equivalent function body.
> 
> Ciao,
> 
> Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list