[PATCH] D61282: [InlineCost] Check if caller formulates indirect recursion.

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 14:35:23 PDT 2019


twoh created this revision.
twoh added reviewers: david2050, modocache, eraman, nadav, rnk.
Herald added subscribers: dexonsmith, haicheng, hiraditya, mehdi_amini.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61282

Files:
  llvm/lib/Analysis/InlineCost.cpp
  llvm/test/Transforms/Inline/recursive.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61282.197192.patch
Type: text/x-patch
Size: 4130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190429/92b24fd3/attachment.bin>


More information about the llvm-commits mailing list