LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 28417 - missing tailcall optimization
Summary: missing tailcall optimization
Status: RESOLVED DUPLICATE of bug 8233
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: 3.8
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-04 13:16 PDT by Ivan Sorokin
Modified: 2020-05-11 07:59 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Sorokin 2016-07-04 13:16:10 PDT
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()
Comment 1 Nikita Kniazev 2020-05-11 07:59:44 PDT

*** This bug has been marked as a duplicate of bug 8233 ***