[Bug tree-optimization/71761] missing tailcall optimization
vanyacpp at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jul 4 20:07:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71761
--- Comment #2 from Ivan Sorokin <vanyacpp at gmail dot com> ---
I compared this with clang.
1) typedef int token;
Both GCC and clang optimize this to a single jump.
2) struct token {int a};
clang optimizes this into a single jump. GCC generates:
subq $8, %rsp
call f()
addq $8, %rsp
ret
3) struct token as in the issue
Both compilers do
pushq %rbx
movq %rdi, %rbx
call f()
movq %rbx, %rax
popq %rbx
ret
I don't quite understand why both clang and GCC generate different code all
these cases.
More information about the Gcc-bugs
mailing list