This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/35310] New: Late struct expansion -- missing PRE (2)
- From: "xinliangli at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Feb 2008 05:27:00 -0000
- Subject: [Bug middle-end/35310] New: Late struct expansion -- missing PRE (2)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
union U {
struct A {
int a;
int b;
}aa;
long long ll;
};
struct B{
union U u1;
union U u2;
} bg;
struct B bg;
struct B bar();
int foo (int n)
{
if (n)
{
bg = bar();
}
return bg.u1.ll + bg.u2.ll;
};
// Two union fields loads are partially redundant.
gcc genearted code at -O2:
foo:
.LFB2:
subq $24, %rsp
.LCFI0:
testl %edi, %edi
je .L2
xorl %eax, %eax
call bar
movq %rax, bg(%rip)
movq %rdx, bg+8(%rip)
.L2:
movq bg(%rip), %rax
addl bg+8(%rip), %eax
addq $24, %rsp
ret
--
Summary: Late struct expansion -- missing PRE (2)
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=35310