| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O -fdump-tree-fre1" } */ |
| 3 |
|
| 4 |
int x = 1; |
| 5 |
int __attribute__((noinline,noclone)) fn () |
| 6 |
{ |
| 7 |
return x; |
| 8 |
} |
| 9 |
int (*f)(); |
| 10 |
int main () |
| 11 |
{ |
| 12 |
int res; |
| 13 |
f = fn; |
| 14 |
x = 0; |
| 15 |
res = f (); |
| 16 |
res += x; |
| 17 |
if (res != 0) |
| 18 |
__builtin_abort (); |
| 19 |
return 0; |
| 20 |
} |
| 21 |
|
| 22 |
/* We should be able to optimize the load from x in main and thus the |
| 23 |
addition. */ |
| 24 |
|
| 25 |
/* { dg-final { scan-tree-dump-times "= x;" 1 "fre1" } } */ |
| 26 |
/* { dg-final { scan-tree-dump-times " \\\+ " 0 "fre1" } } */ |