| 1 |
/* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
int |
| 5 |
f1 (int *x, int n) |
| 6 |
{ |
| 7 |
int res = 0; |
| 8 |
for (int i = 0; i < n; ++i) |
| 9 |
res += x[i * 2] == 1 ? 2 : 3; |
| 10 |
return res; |
| 11 |
} |
| 12 |
|
| 13 |
int |
| 14 |
f2 (int *x) |
| 15 |
{ |
| 16 |
int res = 0; |
| 17 |
for (int i = 0; i < 0x83; ++i) |
| 18 |
res += x[i * 2] == 1 ? 2 : 3; |
| 19 |
return res; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
f3 (int *x, int n) |
| 24 |
{ |
| 25 |
int res = 0; |
| 26 |
for (int i = 0; i < n; ++i) |
| 27 |
res += x[i * 2] == 1 ? 2 : 3; |
| 28 |
return res + x[0x100]; |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
f4 (int *x) |
| 33 |
{ |
| 34 |
int res = 0; |
| 35 |
for (int i = 0; i < 0x83; ++i) |
| 36 |
res += x[i * 2] == 1 ? 2 : 3; |
| 37 |
return res + x[0x100]; |
| 38 |
} |
| 39 |
|
| 40 |
int |
| 41 |
f5 (int *x, int n, int a) |
| 42 |
{ |
| 43 |
int res = 0; |
| 44 |
for (int i = 0; i < n; ++i) |
| 45 |
res += x[i * 2] == 1 ? 2 : 3; |
| 46 |
x[a] += 1; |
| 47 |
return res; |
| 48 |
} |
| 49 |
|
| 50 |
int |
| 51 |
f6 (int *x, int a) |
| 52 |
{ |
| 53 |
int res = 0; |
| 54 |
for (int i = 0; i < 0x83; ++i) |
| 55 |
res += x[i * 2] == 1 ? 2 : 3; |
| 56 |
x[a] += 1; |
| 57 |
return res; |
| 58 |
} |
| 59 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |