Created attachment 15752
Reproducer
To prevent infinite inlining of recursive functions Inliner maintains
InlineHistory structure. However in some cases we might still end up inlining
recursive function chain. It happens when Inliner is executed in a CallGraphSCC
pass manager iteration. CGSCC pass manager spins one more iteration of inlining
if some indirect call site was devirtualized by other CGSCC passes. No
InlineHistory is maintained between these inliner iterations. Small reproducer
is in the attachment.
In practice it's rarely a problem because the number of iterations in CGSCC is
limited by 4 by default. But theoretically it can lead to an exponential growth
of code size.
The suggested fix is to mark recursive call sites encountered by Inliner with
NoInline attribute, so this information will be maintained between inlining
iterations.
inline.ll
(451 bytes, application/octet-stream)