Hi!
I have a llvm::Module that references an external function
and a second mdoule that implements the function.
The implementation consists of only one instruction.
How can I explicitly inline this function?
-Jochen
Hi!
I have a llvm::Module that references an external function
and a second mdoule that implements the function.
The implementation consists of only one instruction.
How can I explicitly inline this function?
-Jochen
There's the "always inline" function attribute.
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.
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