This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/35310] New: Late struct expansion -- missing PRE (2)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]