[Bug tree-optimization/71761] New: missing tailcall optimization

vanyacpp at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 4 18:28:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71761

            Bug ID: 71761
           Summary: missing tailcall optimization
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com
  Target Milestone: ---

Currently GCC doesn't optimize tailcall in the following function:

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():
        pushq   %rbx
        movq    %rdi, %rbx
        call    f()
        movq    %rbx, %rax
        popq    %rbx
        ret

Expected:

g():
        jmp     f()


More information about the Gcc-bugs mailing list