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

            Bug ID: 51461
           Summary: Missed accumulator recursion elimination
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: l...@rifkin.dev
                CC: llvm-bugs@lists.llvm.org

Of the following simple recursive functions, LLVM is able to eliminate
recursion for foo but not bar:

int foo(int n) {
    if(n <= 0) return 1;
    return 2 + foo(n - 1);
}
int bar(int n) {
    if(n <= 0) return 1;
    return 2 * bar(n - 1);
}

GCC optimizes both. https://godbolt.org/z/rozMcn6o4.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to