| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -fdump-ipa-cp-details -fno-inline" } */ |
| 3 |
|
| 4 |
int data1; |
| 5 |
|
| 6 |
int callee1(int *v) |
| 7 |
{ |
| 8 |
if (*v < 2) |
| 9 |
return 0; |
| 10 |
else |
| 11 |
{ |
| 12 |
int t = data1; |
| 13 |
|
| 14 |
data1 = *v; |
| 15 |
*v = t; |
| 16 |
|
| 17 |
return 1; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
int __attribute__((pure)) callee2(int *v) |
| 22 |
{ |
| 23 |
if (*v < 2) |
| 24 |
return 0; |
| 25 |
else |
| 26 |
{ |
| 27 |
data1 = v[0] + v[2]; |
| 28 |
|
| 29 |
return 1; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
int caller1(int c, int *r) |
| 34 |
{ |
| 35 |
int a = 1; |
| 36 |
|
| 37 |
if (c) |
| 38 |
return callee1(&a); |
| 39 |
else |
| 40 |
{ |
| 41 |
*r = 2; |
| 42 |
return callee1(r); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
int data2[200]; |
| 47 |
int data3; |
| 48 |
|
| 49 |
int __attribute__((const)) gen_cond(int); |
| 50 |
|
| 51 |
int caller2(void) |
| 52 |
{ |
| 53 |
int i, j; |
| 54 |
int sum = 0; |
| 55 |
int a[8]; |
| 56 |
|
| 57 |
a[0] = 3; |
| 58 |
for (i = 0; i < 100; i++) |
| 59 |
{ |
| 60 |
if (gen_cond (i)) |
| 61 |
continue; |
| 62 |
|
| 63 |
a[2] = 4; |
| 64 |
for (j = 0; j < 100; j++) |
| 65 |
{ |
| 66 |
data2[i + j] = (i ^ j) + data3; |
| 67 |
|
| 68 |
sum += callee2(a); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
return sum; |
| 73 |
} |
| 74 |
|
| 75 |
/* { dg-final { scan-ipa-dump-times "offset: 0, type: int, CONST: 1" 1 "cp" } } */ |
| 76 |
/* { dg-final { scan-ipa-dump-times "offset: 0, type: int, CONST: 2" 1 "cp" } } */ |
| 77 |
/* { dg-final { scan-ipa-dump-times "offset: 0, type: int, CONST: 3" 1 "cp" } } */ |
| 78 |
/* { dg-final { scan-ipa-dump-times "offset: 64, type: int, CONST: 4" 1 "cp" } } */ |