If a function uses stack heavily, the function shouldn't be inlined if the
caller can be recursively invoked, because it may lead stack size explosion.
Current inliner implemention only checks for self-recursion, but indirectely
recursive function has the same risk, and that actually happens with MySQL5.6+LTO.
To overcome this limitation, this diff adds a knob that can control the
"degree" of indirect recursion that the inliner attempts to detect. The default
value is 1 which means that it only checks for self-recursion, and wouldn't
change the current behavior.. MySQL issue can be addressed by setting the flag
to 2.
Can you also add a test to show what happens if @large_stack_callee is not called?
It should then be inlined?
Or is the intention to completely prohibit inlining of recursive calls?