[llvm-bugs] [Bug 26371] New: Infinite inlining of recursive functions

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 29 06:04:20 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26371

            Bug ID: 26371
           Summary: Infinite inlining of recursive functions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: apilipenko at azulsystems.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15752
  --> https://llvm.org/bugs/attachment.cgi?id=15752&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160129/c9bbb7d7/attachment.html>


More information about the llvm-bugs mailing list