| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
int x; |
| 5 |
|
| 6 |
int |
| 7 |
f1 (int i, int j, int k) |
| 8 |
{ |
| 9 |
int *p = k ? &i : &j; |
| 10 |
i = 3; |
| 11 |
*p = 5; |
| 12 |
x = j; |
| 13 |
} |
| 14 |
|
| 15 |
/* The assignment "i = 3" is partially dead. Our DSE pass doesn't handle |
| 16 |
detection of partially dead assignments. |
| 17 |
|
| 18 |
There's two outputs which would indicate that the optimization was |
| 19 |
performed. |
| 20 |
|
| 21 |
If we used block copying to detect and eliminate the partially dead |
| 22 |
store, then we should see an assignment "i = 5" somewhere in the |
| 23 |
dump file. |
| 24 |
|
| 25 |
Another approach would be to redirect the path from the true arm |
| 26 |
of the first conditional so that it reaches the statement *p = 5 |
| 27 |
rather than i = 3. */ |
| 28 |
|
| 29 |
/* { dg-final { scan-tree-dump-times "i = 5" 1 "optimized" { xfail *-*-* }} } */ |
| 30 |
/* { dg-final { scan-tree-dump-times "<L.*>:;\[\n\t \]*\\*p = 5" 1 "optimized" { xfail *-*-*}} } */ |
| 31 |
|
| 32 |
|