[Bug rtl-optimization/44194] struct returned by value generates useless stores
jhaberman at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Feb 24 05:10:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44194
--- Comment #8 from Josh Haberman <jhaberman at gmail dot com> 2011-02-24 03:27:04 UTC ---
I found another test case for this. I thought I'd post it since it's extremely
different than the original one.
--
class Foo {
public:
virtual ~Foo() {}
virtual void DoSomething() = 0;
};
void foo(Foo *f, void (Foo::*member)()) {
(f->*member)();
}
--
$ g++ -c -O3 -fomit-frame-pointer test.cc
$ objdump -M intel -d test.o
test.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <_Z3fooP3FooMS_FvvE>:
0: 40 f6 c6 01 test sil,0x1
4: 48 89 74 24 e8 mov QWORD PTR [rsp-0x18],rsi
9: 48 89 54 24 f0 mov QWORD PTR [rsp-0x10],rdx
e: 74 10 je 20 <_Z3fooP3FooMS_FvvE+0x20>
10: 48 01 d7 add rdi,rdx
13: 48 8b 07 mov rax,QWORD PTR [rdi]
16: 48 8b 74 30 ff mov rsi,QWORD PTR [rax+rsi*1-0x1]
1b: ff e6 jmp rsi
1d: 0f 1f 00 nop DWORD PTR [rax]
20: 48 01 d7 add rdi,rdx
23: ff e6 jmp rsi
--
We spilled rsi and rdx to the stack (in the red zone, it appears) for no reason
(AFAICS).
More information about the Gcc-bugs
mailing list