Is there any way to inline just some selective calls to a particular function not all of them? cause only form I know is declaring function as such at beginning and that’s supposed to effect all calls to that function.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, some background on inlining.
There are multiple phases where inlining might occur (for example):
All of them share a common point: they inline selectively, ie if it is worth at the point of call.
In C++, you can hint to the compiler that a function might be worth inlining using the
inline, but it’ll still perform a performance analysis with its own heuristics. The main use being that free functions declared inline do not lead to link failures because of duplicate symbols.MSVC also supports
__forceinlinewhich forces inline… unless it’s impossible (virtual call, function pointer, /O0, …)Therefore: it’s not really possible to force / prevent inlining as far as I know. LTO even allows (in some circumstances) the inlining of virtual methods (which requires whole program analysis, thus is only suitable at the exec stage).