re PR c++/23372 (Temporary aggregate copy not elided when passing parameters by value)

2006-01-30  Richard Guenther  <rguenther@suse.de>

	PR c++/23372
	* gimplify.c (gimplify_target_expr): Handle easy cases
	without creating a temporary.

	* gcc.dg/pr23372-1.C: New testcase.

From-SVN: r110396
This commit is contained in:
Richard Guenther 2006-01-30 13:46:30 +00:00 committed by Richard Biener
parent 4e852d1f9d
commit eb73a69a15
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-01-30 Richard Guenther <rguenther@suse.de>
PR c++/23372
* gimplify.c (gimplify_target_expr): Handle easy cases
without creating a temporary.
2006-01-30 Nathan Sidwell <nathan@codesourcery.com>
* vec.h (safe_grow): Remove duplicated line.

View File

@ -4053,6 +4053,15 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
if (init)
{
/* Try to avoid the temporary if possible. */
if (TREE_CODE (init) == INDIRECT_REF
&& !TREE_SIDE_EFFECTS (init)
&& !TARGET_EXPR_CLEANUP (targ))
{
*expr_p = init;
return GS_OK;
}
/* TARGET_EXPR temps aren't part of the enclosing block, so add it
to the temps list. */
gimple_add_tmp_var (temp);

View File

@ -1,3 +1,8 @@
2006-01-30 Richard Guenther <rguenther@suse.de>
PR c++/23372
* gcc.dg/pr23372-1.C: New testcase.
2006-01-29 Diego Novillo <dnovillo@redhat.com>
* gcc.dg/gomp/pr25874.c: New test.

View File

@ -0,0 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-Os" } */
struct A {
int a[1000];
};
void f(struct A);
void g(struct A *a) { f(*a); }
/* { dg-final { scan-assembler-times "memcpy" 1 } } */