Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out which functions were NOT inlined

Tags:

c++

c

gcc

inline

Is there a way to obtain a list of functions that were NOT inlined anywhere? Either by passing an option to gcc or by inspecting the binary?

EDIT: I know how to explicitly ask for a function not to be inlined by using gcc's builtin attribute noinline.

like image 712
Giovanni Funchal Avatar asked Feb 08 '12 09:02

Giovanni Funchal


2 Answers

Add -fdump-ipa-inline to your compiler options.

Grep the file yoursourcefile.inline which is created next to the object file for "Considering inline candidate" to find out all functions that the compiler considered inlining.

Grep the file for "Inlined into" to find out all functions that the compiler finally did inline.
Grep for "inline_failed:" if you are interested for the reason why the compiler turned down a candidate (e.g. "call is unlikely and code size would grow").

like image 186
Damon Avatar answered Nov 15 '22 16:11

Damon


Use gcc's -fdump-tree-all and search the dump files for "inline".

like image 42
ams Avatar answered Nov 15 '22 15:11

ams