[PATCH] D98481: [Inliner] Do not inline mutual-recursive functions to avoid exponential size growth.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 11 23:44:35 PST 2021
hoy created this revision.
Herald added subscribers: wenlei, hiraditya, eraman.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This change avoids inlining a function involved in a mutual-recursive cycle. Due to the lack of a global inline history, such inlining may cause an exponential size growth as the inlining extends up along the call graph.
Consider the following example,
void A() { B(); B();}
void B() { A(); }
void C() { B(); }
void D() { C(); }
When processing C, inlining B will result in
void C() { B(); B(); }
When processing D, inlining C and futher the two B callsites will result in
void D() { B(); B(); B(); B(); }
We've also seen that one of our internal services suffered from the inliner hanging for 6 hours.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98481
Files:
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/test/Transforms/Inline/recursion.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98481.330157.patch
Type: text/x-patch
Size: 5668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210312/38b64502/attachment.bin>
More information about the llvm-commits
mailing list