| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-lim2-details" } */ |
| 3 |
|
| 4 |
char x; |
| 5 |
|
| 6 |
long foo (int n) |
| 7 |
{ |
| 8 |
long y = 0; |
| 9 |
for (int j = 0; j < 1024; ++j) |
| 10 |
for (int i = 0; i < n; ++i) |
| 11 |
y += *(long *)&x; |
| 12 |
return y; |
| 13 |
} |
| 14 |
|
| 15 |
/* Because *(long *)&x may trap we have to preserve execution and |
| 16 |
only hoist it from the innermost loop (after the header check). */ |
| 17 |
/* { dg-final { scan-tree-dump-not "out of loop 1" "lim2" } } */ |
| 18 |
/* { dg-final { scan-tree-dump "out of loop 2" "lim2" } } */ |