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: unassignedb...@nondot.org
          Reporter: apilipe...@azulsystems.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to