Here are two cute tricks for understanding and controlling GCC’s inlining decisions that I learned recently while preparing to help mentor for MIT’s Performance Engineering class (2010 OCW lectures).
GCC has a debugging
option called -fdump-ipa-inline
. When given, GCC will
output a log file that describes, on a call-site-by-call-site basis,
what inlining decision it made and why.
(As a result, with this flag set, one can write unit tests to check the outcome of critical inlining decisions!)
If you’ve found an inlining decision that makes you unhappy and
your normal static inline ...
declaration isn’t cutting the
mustard, then GCC’s always_inline
and noinline
function
attributes might be what you’re looking for!
Other tricks:
-ftree-vectorize-verbose=7
(-vec-report3
with
ICC) or -fdump-tree-vect
will give you lots of
informationOther links: