| 1 |
/* A testcase for PR 40744. We do not want to create replacements for object |
| 2 |
that are dead or have only a single use, whenever it can be avoided |
| 3 |
simply. */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-O1 -fdump-tree-esra-details" } */ |
| 6 |
|
| 7 |
struct X { int i; int j; }; |
| 8 |
|
| 9 |
void foo(void) |
| 10 |
{ |
| 11 |
struct X x; |
| 12 |
x.i = 1; |
| 13 |
x.j = 2; |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
int bar(struct X x) |
| 18 |
{ |
| 19 |
return x.i; |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
extern void do_something (struct X); |
| 24 |
|
| 25 |
void bar2(int i, int j) |
| 26 |
{ |
| 27 |
struct X x; |
| 28 |
|
| 29 |
x.i = i; |
| 30 |
x.j = j; |
| 31 |
do_something (x); |
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-tree-dump-times "Created a replacement" 0 "esra"} } */ |