| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-dse2-details" } */ |
| 3 |
volatile int *ptr; |
| 4 |
struct a { |
| 5 |
int a,b,c; |
| 6 |
} a; |
| 7 |
__attribute__((noinline)) |
| 8 |
static int init (struct a*a) |
| 9 |
{ |
| 10 |
a->a=0; |
| 11 |
a->b=1; |
| 12 |
a->c=1; |
| 13 |
} |
| 14 |
__attribute__((noinline)) |
| 15 |
static int use (struct a*a) |
| 16 |
{ |
| 17 |
if (a->c != 3) |
| 18 |
*ptr=5; |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
main(void) |
| 23 |
{ |
| 24 |
struct a a; |
| 25 |
init (&a); |
| 26 |
a.c=3; |
| 27 |
use (&a); |
| 28 |
} |
| 29 |
/* Only DSE2 is tracking live bytes needed to figure out that store to c is |
| 30 |
also dead above. */ |
| 31 |
/* { dg-final { scan-tree-dump "Deleted dead store: init" "dse2" } } */ |