Search code examples
llvminlinellvm-clang

big functions do not inline llvm -inline pass


It seems like llvm -inline pass only inlines small functions. Is there a way to inline all functions, no matter how big they are?


Solution

  • You can use the -inline-threshold flag to change the "cost" up to which LLVM will inline a function. A higher value means more functions will be inlined.

    opt -inline -inline-threshold=10000 ...

    Obviously functions can not always be inlined, particularly when the call graph contains cycles (recursive calls).