Does clang have any feature for automatic inlining of functions? If I have functions that are not declared with static inline, is there any way I could get the front end to inline some of the functions (based on size) using command line options?
If you're using the clang executable, it does automatic inlining as
long as you turn on the optimizers. You can tweak how aggressive the
inliner is with the -inline-threshold command-line parameter; the
default value is 200.
If you're writing your own program using the clang libraries, you'll
have to invoke the inliner yourself; http://llvm.org/docs/ would be
helpful for that.
That said, what are you planning to do with clang? We're always
interested in hearing about new users.
We’re looking at using clang as an OpenCL frontend. I can’t find --inline-threshold in the list of options for the clang executable. I looked through the source code as well and cannot find any mentioning of the option inline-threshold.
I can't find
--inline-threshold in the list of options for the clang executable.
It's a hidden option. You can use clang -help-hidden to get a more
complete list of options.
looked through the source code as well and cannot find any mentioning of the
It's in llvm/lib/Transforms/IPO/Inliner.cpp.
Thank you, Eli. This works!