This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/40744] New: SRA scalarizes dead objects, single-use objects
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jul 2009 11:01:39 -0000
- Subject: [Bug tree-optimization/40744] New: SRA scalarizes dead objects, single-use objects
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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