Commit 192d2ed8 authored by rguenth's avatar rguenth
Browse files

2012-01-31 Richard Guenther <rguenther@suse.de>

	PR tree-optimization/51528
	* tree-sra.c (sra_modify_assign): Avoid copy-in/out for aggregate
	assigns.

	* gcc.dg/torture/pr51528.c: New testcase.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183752 138bc75d-0d04-0410-961f-82ee72b054a4
parent 32a07a44
2012-01-31 Richard Guenther <rguenther@suse.de>
PR tree-optimization/51528
* tree-sra.c (sra_modify_assign): Avoid copy-in/out for aggregate
assigns.
2012-01-31 Jakub Jelinek <jakub@redhat.com> 2012-01-31 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/52041 PR bootstrap/52041
......
2012-01-31 Richard Guenther <rguenther@suse.de>
PR tree-optimization/51528
* gcc.dg/torture/pr51528.c: New testcase.
2012-01-30 Uros Bizjak <ubizjak@gmail.com> 2012-01-30 Uros Bizjak <ubizjak@gmail.com>
PR go/48501 PR go/48501
......
/* { dg-do run } */
/* { dg-options "-fno-early-inlining" } */
extern void abort (void);
union U
{
int i;
_Bool b;
};
_Bool gb;
void __attribute__ ((noinline))
use_bool (union U u)
{
gb = u.b;
}
union U
bar (void)
{
union U u;
u.i = 0xFFFE;
return u;
}
union U __attribute__ ((noinline))
foo (void)
{
union U u,v;
u.b = 1;
use_bool (u);
u = bar ();
return u;
}
int main (int argc, char **argv)
{
union U u = foo ();
if (u.i != 0xFFFE)
abort ();
return 0;
}
...@@ -3135,9 +3135,14 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi) ...@@ -3135,9 +3135,14 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi)
sra_stats.deleted++; sra_stats.deleted++;
return SRA_AM_REMOVED; return SRA_AM_REMOVED;
} }
/* Restore the aggregate RHS from its components so the
prevailing aggregate copy does the right thing. */
if (access_has_children_p (racc)) if (access_has_children_p (racc))
generate_subtree_copies (racc->first_child, lhs, racc->offset, generate_subtree_copies (racc->first_child, racc->base, 0, 0, 0,
0, 0, gsi, false, true, loc); gsi, false, false, loc);
/* Re-load the components of the aggregate copy destination.
But use the RHS aggregate to load from to expose more
optimization opportunities. */
if (access_has_children_p (lacc)) if (access_has_children_p (lacc))
generate_subtree_copies (lacc->first_child, rhs, lacc->offset, generate_subtree_copies (lacc->first_child, rhs, lacc->offset,
0, 0, gsi, true, true, loc); 0, 0, gsi, true, true, loc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment