public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/40744]  New: SRA scalarizes dead objects, single-use objects
@ 2009-07-14 11:01 rguenth at gcc dot gnu dot org
  2009-07-14 16:32 ` [Bug tree-optimization/40744] " jamborm at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-14 11:01 UTC (permalink / raw)
  To: gcc-bugs

struct X { int i; int j; };
void foo(void)
{
  struct X x;
  x.i = 1;
  x.j = 2;
}

early SRA produces

foo ()
{
  int x$j;
  int x$i;
  struct X x;

<bb 2>:
  x$i_3 = 1;
  x$j_2 = 2;
  return;


which is unnecessary work as DCE will end up removing the stores anyway.
We should avoid doing useless work here (and thus not skew statistics
compared to when somebody inserts DCE before ESRA).  At least if it is
easy to do.

Likewise for

struct X { int i; int j; };
int foo(struct X x)
{
  return x.i;
}

early SRA produces an extra register copy with no benefit.

foo (struct X x)
{
  int x$i;
  int D.1606;

<bb 2>:
  x$i_3 = x.i;
  D.1606_1 = x$i_3;
  return D.1606_1;

}

both cases, only loads from a structure or only stores to a structure
probably should be simply skipped.


-- 
           Summary: SRA scalarizes dead objects, single-use objects
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: compile-time-hog
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

end of thread, other threads:[~2009-09-03  8:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-14 11:01 [Bug tree-optimization/40744] New: SRA scalarizes dead objects, single-use objects rguenth at gcc dot gnu dot org
2009-07-14 16:32 ` [Bug tree-optimization/40744] " jamborm at gcc dot gnu dot org
2009-07-14 21:28 ` rguenther at suse dot de
2009-07-30 14:19 ` jamborm at gcc dot gnu dot org
2009-07-30 14:30 ` rguenther at suse dot de
2009-07-30 17:08 ` jamborm at gcc dot gnu dot org
2009-07-30 17:10 ` jamborm at gcc dot gnu dot org
2009-07-31  9:12 ` rguenther at suse dot de
2009-09-02 18:03 ` jamborm at gcc dot gnu dot org
2009-09-03  8:48 ` ubizjak at gmail dot com

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).