[llvm-bugs] [Bug 28417] New: missing tailcall optimization

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 4 11:16:10 PDT 2016


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

            Bug ID: 28417
           Summary: missing tailcall optimization
           Product: libraries
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: vanyacpp at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

For this code LLVM generates code that doesn't use tailcall optimization.

struct token
{
    char const* tok_start;
    char const* tok_end;
    int tok_type;
    unsigned identifier_hash;
};

token f();

token g()
{
  return f();
}

Generated code:

g():                                  # @g()
        pushq   %rbx
        movq    %rdi, %rbx
        callq   f()
        movq    %rbx, %rax
        popq    %rbx
        retq



Expected code:

g():                                  # @g()
        jmpq    f()

-- 
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/20160704/3987bc91/attachment.html>


More information about the llvm-bugs mailing list