| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */ |
| 3 |
/* { dg-add-options bind_pic_locally } */ |
| 4 |
|
| 5 |
struct S |
| 6 |
{ |
| 7 |
int a, b, c; |
| 8 |
}; |
| 9 |
|
| 10 |
void *blah(int, void *); |
| 11 |
|
| 12 |
static void __attribute__ ((noinline)) foo (int x, int z, struct S *p); |
| 13 |
|
| 14 |
static void __attribute__ ((noinline)) |
| 15 |
bar (int x, int z, struct S *p) |
| 16 |
{ |
| 17 |
foo (z, x, p); |
| 18 |
} |
| 19 |
|
| 20 |
static void __attribute__ ((noinline)) |
| 21 |
foo (int x, int z, struct S *p) |
| 22 |
{ |
| 23 |
int i, c = p->c; |
| 24 |
int b = p->b - z; |
| 25 |
void *v = (void *) p; |
| 26 |
|
| 27 |
if (z) |
| 28 |
{ |
| 29 |
z--; |
| 30 |
bar (z, x, p); |
| 31 |
} |
| 32 |
for (i = 0; i< c; i++) |
| 33 |
v = blah(b + x + i, v); |
| 34 |
} |
| 35 |
|
| 36 |
void |
| 37 |
entry (int c) |
| 38 |
{ |
| 39 |
struct S s; |
| 40 |
int i; |
| 41 |
|
| 42 |
for (i = 0; i<c; i++) |
| 43 |
{ |
| 44 |
s.a = c; |
| 45 |
s.b = 64; |
| 46 |
s.c = 32; |
| 47 |
foo (4, i, &s); |
| 48 |
} |
| 49 |
} |
| 50 |
/* { dg-final { scan-ipa-dump-times "Clone of bar" 1 "cp" } } */ |
| 51 |
/* { dg-final { scan-ipa-dump-times "Clone of foo" 1 "cp" } } */ |
| 52 |
/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */ |