Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Inlining of function pointer arguments to other functions

Ron_Green
Moderator
461 Views

In the past, I’ve asked about what we can expect from IPO with the Intel compiler.  My take away from that was that we cannot expect Intel C++ to inline function pointer arguments to other functions when the two are in different translation units.

What about the case where both the caller and callee are in the same translation unit, and  we are compiling with just “–ip”?

0 Kudos
4 Replies
KitturGanesh
Employee
461 Views

Hi Ron!
When the two are in different translation units, -ip will not be able to cause inlining to happen, but –ipo might be able to do so.  It all depends on whether it can resolve the indirect call to one or more targets, and predict profitably which of those targets are most likely to be called.  That said, the advise is for you to use -ipo. 
You should be able to look at the inlining report of the optimization report to see whether the func pointers were inlined or not. Note that the calls marked as external aren't candidates for inlining since they could be another translation unit etc.

_Cheers,
Kittur


 

0 Kudos
KitturGanesh
Employee
461 Views

Hi Ron,
Did you have a chance to check my earlier response? Let me know if you have any further clarifications, appreciate much.
_Kittur 

0 Kudos
Ron_Green
Moderator
461 Views

that answered it.

 

functions referenced by pointers are not inlining candidates, as the pointer could potentially point to any function in the code and hence what would you inline? yes, this issue is closed.

 

 

 

0 Kudos
KitturGanesh
Employee
461 Views

Thanks Ron, a pleasure to have answered your question.
  _Kittur

0 Kudos
Reply