| 1 |
/* PR100112 and dups. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-fre1-details -fdump-tree-optimized" } */ |
| 4 |
|
| 5 |
int *c, *b; |
| 6 |
void foo() |
| 7 |
{ |
| 8 |
int *tem = b; |
| 9 |
*tem = 0; |
| 10 |
int *footem = c; |
| 11 |
c = footem; |
| 12 |
} |
| 13 |
|
| 14 |
void bar() |
| 15 |
{ |
| 16 |
int *tem = b; |
| 17 |
int *bartem = c; |
| 18 |
*tem = 0; |
| 19 |
c = bartem; |
| 20 |
} |
| 21 |
|
| 22 |
/* We should elide the redundant store in foo, in bar it is not redundant since |
| 23 |
the *tem = 0 store might alias. */ |
| 24 |
/* { dg-final { scan-tree-dump "Deleted redundant store c = footem" "fre1" } } */ |
| 25 |
/* { dg-final { scan-tree-dump "c = bartem" "optimized" } } */ |