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.
I have a fix, it does what I recommended.
I am no longer working on this, this is a much harder problem than I sugested. This is basically the same as PR 18268.
Can you elaborate on why the VIEW_CONVERT_EXPR experiment failed and perhaps attach the patch you tried? Or does using VIEW_CONVERT_EXPR just expose that we don't do structure propagation?
(In reply to comment #3) > Can you elaborate on why the VIEW_CONVERT_EXPR experiment failed and perhaps > attach the patch you tried? Or does using VIEW_CONVERT_EXPR just expose that > we don't do structure propagation? VCE failed because it causes some missed optimizations and really just exposed the fact we don't have structure copy prop.
I am just going to mark this one as a dup of bug 22156, because it is the same problem, just different testcases. *** This bug has been marked as a duplicate of 22156 ***