| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O -fdump-tree-dse1-details" } */ |
| 3 |
|
| 4 |
struct X { int x; }; |
| 5 |
struct X x; |
| 6 |
|
| 7 |
extern struct X foo (void); |
| 8 |
void bar() |
| 9 |
{ |
| 10 |
x = foo(); |
| 11 |
x = (struct X){}; |
| 12 |
} |
| 13 |
|
| 14 |
extern struct X __attribute__((const)) foo2 (int); |
| 15 |
void bar2() |
| 16 |
{ |
| 17 |
x = foo2 (1); |
| 18 |
x = foo2 (2); |
| 19 |
} |
| 20 |
|
| 21 |
/* { dg-final { scan-tree-dump-times "Deleted dead store in call LHS: x = foo " 1 "dse1" } } */ |
| 22 |
/* { dg-final { scan-tree-dump-times "Deleted dead store: x = foo2 " 1 "dse1" } } */ |