I am trying to diagnose a weird performance problem that I think is related to a failure of GCC to inline some function calls in C++, though I am not sure which function calls. Is there a flag to GCC to list all line numbers where inlining was performed?
Asked
Active
Viewed 209 times
6
-
1The answer to your question is here: [C++: How will i know whether inline function is actually replaced?](http://stackoverflow.com/questions/10631283/how-will-i-know-whether-inline-function-is-actually-replaced-at-the-place-where). The question was slightly, different, but the answers are very enlightening. – FoggyDay Aug 09 '14 at 01:14
1 Answers
0
The answer to your question is here:
C++: How will i know whether inline function is actually replaced?.
The question was slightly different from yours, but the responses are spot-on - and definitely enlightening. I encourage you to read them.
In answer to your question, however:-Winline
will generate a warning if the compiler chooses not to inline:
https://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Warning-Options.html
-
That answer does not quite answer my question. Checking the assembly is tedious, because I am not sure which call site is the problem. I have a performance regression that depends when I use separate compilation as opposed to compiling all .cpp's at once into a shared library. This strongly suggests an inlining issue to me, but doesn't tell me where. The option -Winline is somewhat limited, as the compiler can (and very often does) inline functions that are not declared inline, but -Winline does not report whether non-explicitly inlined functions are inlined. – John Jumper Aug 09 '14 at 01:27
-
@JohnJumper Maybe check here for more hints about assembly http://stackoverflow.com/questions/1289881/using-gcc-to-produce-readable-assembly If it is tedious why not automate it?? Generate assembly and check if the line you want is inlined?? – Brandin Aug 09 '14 at 06:15