// Example: the load of structs at return is partially redundant struct A { int a; int b; int c; int d; } ag, ag2,ag3;
struct A foo(int n) { if (n) { ag2 = ag; } return ag; } // Gcc generated assembly code: foo: .LFB2: testl %edi, %edi je .L2 movq ag(%rip), %rax movq %rax, ag2(%rip) movq ag+8(%rip), %rax movq %rax, ag2+8(%rip) .L2: movq ag+8(%rip), %rdx movq ag(%rip), %rax ret .LFE2: -- Summary: Late struct expansion leads to missing PRE Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: xinliangli at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35309