[LLVMdev] How to control inlining in llvm?

Yuri yuri at rawbw.com
Mon Jun 30 11:30:29 PDT 2014


I asked this question before, but wasn't satisfied with answers.

How can (expert) users control inlining in llvm? gcc has these 
parameters: -finline-limit, --param max-inline-insns-single, --param 
inline-unit-growth, etc. What are the llvm equivalents?

While running large and complex industrial processes, I found that 
inlining can significantly change the speed of individual processes. 
Usually the more inlining there is, the faster the process runs. In gcc 
I actually was setting insanely high inlining values because that's what 
usually gave the fastest code, even though there should be some limit 
after which speed should theoretically degrade.

Now it looks like there are no llvm equivalents.

Answers given before are these: compiler should know better how to 
inline, users should trust compiler to "do the right thing", such 
options might not be stable between versions, compiler should just be 
faster without any such flags, many users will be tempted to set some 
values they don't understand and they will be floating in their 
makefiles forever without meaning.

For someone who is after the wall clock time such answers are naive. 
Compiler can't predict what heuristics the resulting code will exhibit 
under particular conditions. Maybe I want to inline 2X or 5X more than 
-O3 allows, and I am willing to spend this CPU time on compile and see. 
There are customers for which 10% improvement means a lot of difference. 
Why does llvm take away such choice from the users?

This lack of inlining tuning variables is a sticking point for me in 
switching to clang.

Yuri



More information about the llvm-dev mailing list