http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53772
Bug #: 53772 Summary: Failed to combine load and jump on vtable Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: areg.melikadam...@gmail.com, ubiz...@gmail.com Target: x86-64 [hjl@gnu-6 tmp]$ cat v.cc struct Foo { virtual void f(); }; void f(Foo *f) { f->f(); } [hjl@gnu-6 tmp]$ /opt/llvm/bin/clang -S -m64 -O2 -o clang64.s v.cc [hjl@gnu-6 tmp]$ cat clang64.s .file "v.cc" .text .globl _Z1fP3Foo .align 16, 0x90 .type _Z1fP3Foo,@function _Z1fP3Foo: # @_Z1fP3Foo .cfi_startproc # BB#0: # %entry movq (%rdi), %rax jmpq *(%rax) # TAILCALL .Ltmp0: .size _Z1fP3Foo, .Ltmp0-_Z1fP3Foo .cfi_endproc .section ".note.GNU-stack","",@progbits [hjl@gnu-6 tmp]$ /usr/gcc-4.7.2-x32/bin/gcc -S -O2 -m64 v.cc -o gcc64.s [hjl@gnu-6 tmp]$ cat gcc64.s .file "v.cc" .text .p2align 4,,15 .globl _Z1fP3Foo .type _Z1fP3Foo, @function _Z1fP3Foo: .LFB0: .cfi_startproc movq (%rdi), %rax movq (%rax), %rax jmp *%rax .cfi_endproc .LFE0: .size _Z1fP3Foo, .-_Z1fP3Foo .ident "GCC: (GNU) 4.7.2 20120622 (prerelease)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 tmp]$