public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-14295-1008@http.gcc.gnu.org/bugzilla/>]
* [Bug optimization/14295] New: [tree-ssa] copy propagation for aggregates
@ 2004-02-25 17:37 dann at godzilla dot ics dot uci dot edu
  2004-05-27  5:28 ` [Bug tree-optimization/14295] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-02-25 17:37 UTC (permalink / raw)
  To: gcc-bugs

This is a (possible?) enhancement request. 
There already is a testcase in the testsuite for this: 20031106-6.c

struct s
{
  char d;
  int a, b;
  double m;
};

struct s foo (struct s r)
{
  struct s temp_struct1;
  struct s temp_struct2;
  struct s temp_struct3;
  temp_struct1 = r;
  temp_struct2 = temp_struct1;
  temp_struct3 = temp_struct2;
  return temp_struct3;
}

The .optimized dump is: 

foo (r)
{
  double r$m;
  int r$b;
  int r$a;
  struct s temp_struct3;

<bb 0>:
  r$a = r.a;
  r$b = r.b;
  r$m = r.m;
  temp_struct3.d = r.d;
  temp_struct3.a = r$a;
  temp_struct3.b = r$b;
  temp_struct3.m = r$m;
  return temp_struct3;
}

It would be nice if it would be just "return r;"

SRA could take care of things like this, but that might be much more work, plus
it precludes from using more optimized memory copy sequences for 
aggregate copying instead of series of loads and store. 

BTW, the above code seems strange too, temporaries are created for r.a, r.b 
and r.m, but not for r.d 

Another compiler produces the following assembly:

        mov     eax, DWORD PTR $T552[esp-4]
        push    esi
        push    edi
        mov     ecx, 6
        lea     esi, DWORD PTR _r$[esp+4]
        mov     edi, eax
        rep movsd
        pop     edi
        pop     esi

-- 
           Summary: [tree-ssa] copy propagation for aggregates
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-24 13:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14295-4@http.gcc.gnu.org/bugzilla/>
2024-05-24 13:50 ` [Bug tree-optimization/14295] [tree-ssa] copy propagation for aggregates pinskia at gcc dot gnu.org
     [not found] <bug-14295-1008@http.gcc.gnu.org/bugzilla/>
2006-01-07 18:04 ` steven at gcc dot gnu dot org
2006-01-14 12:16 ` rguenth at gcc dot gnu dot org
2006-02-14 15:53 ` rguenth at gcc dot gnu dot org
2006-03-10 15:34 ` dnovillo at gcc dot gnu dot org
2008-01-27 15:36 ` rguenth at gcc dot gnu dot org
2008-06-22 15:06 ` rguenth at gcc dot gnu dot org
2008-06-22 15:07 ` rguenth at gcc dot gnu dot org
2004-02-25 17:37 [Bug optimization/14295] New: " dann at godzilla dot ics dot uci dot edu
2004-05-27  5:28 ` [Bug tree-optimization/14295] " pinskia at gcc dot gnu dot org
2004-06-29 17:41 ` pinskia at gcc dot gnu dot org
2005-09-14 17:35 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).