Take the following code:
struct s
{
  short t;
  short y1;
};

void f(struct s *x, struct s *y)
{
  struct s t = *x;
  *y = t;
}

In 3.4.0, we produced:
_f:
        lwz r0,0(r3)
        stw r0,0(r4)
        blr
but in 4.0.0 and above:
_f:
        lhz r2,2(r3)
        lha r0,0(r3)
        sth r2,2(r4)
        sth r0,0(r4)
        blr

I am starting to think we should use VIEW_CONVERT_EXPR in SRA and store it into 
a type which is the 
same as the mode if the mode is not BKL_MODE (RTL mode by the way) and we don't 
access the 
temporary variable's fields.  That would fix PR 22156 also.  Maybe I can look 
into doing this.

-- 
           Summary: [4.0/4.1 Regression] struct copying code gen
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,rth at gcc dot gnu dot
                    org
OtherBugsDependingO 22156
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22157

Reply via email to