| 1 |
/* Verify that analysis of function parameters works as expected. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O3 -c -fdump-ipa-inline" } */ |
| 4 |
struct bah {int a,b,c,d,e;}; |
| 5 |
static struct bah bah3={2,3,4,5,6}; |
| 6 |
const static struct bah bah4={2,3,4,5,6}; |
| 7 |
void test (int, struct bah *, struct bah, struct bah, int, struct bah, struct bah, struct bah); |
| 8 |
void foo (int invariant, struct bah invariant2) |
| 9 |
{ |
| 10 |
int i; |
| 11 |
struct bah bah2={1,2,3,4,5}; |
| 12 |
struct bah bah5={1,2,3,4,5}; |
| 13 |
for (i = 0; i<10; i++) |
| 14 |
{ |
| 15 |
bah5.a=i; |
| 16 |
test (i, &bah2, bah2, bah3, invariant, invariant2, bah4, bah5); |
| 17 |
} |
| 18 |
} |
| 19 |
/* op0 change on every invocation. */ |
| 20 |
/* op1 is function invariant. */ |
| 21 |
/* { dg-final { scan-ipa-dump-not "op0 is compile time invariant" "inline" } } */ |
| 22 |
/* { dg-final { scan-ipa-dump-not "op0 change" "inline" } } */ |
| 23 |
/* { dg-final { scan-ipa-dump "op1 is compile time invariant" "inline" } } */ |
| 24 |
/* op2 is invariant within loop (we make assumption that function call does not afect it.). */ |
| 25 |
/* { dg-final { scan-ipa-dump "op2 change 9.990000. of time" "inline" } } */ |
| 26 |
/* op3 is invariant within loop (we make assumption that function call does not afect it.). */ |
| 27 |
/* { dg-final { scan-ipa-dump "op3 change 9.990000. of time" "inline" } } */ |
| 28 |
/* op4 is invariant within loop. */ |
| 29 |
/* { dg-final { scan-ipa-dump "op4 change 9.990000. of time" "inline" } } */ |
| 30 |
/* op5 is invariant within loop. */ |
| 31 |
/* { dg-final { scan-ipa-dump "op5 change 9.990000. of time" "inline" } } */ |
| 32 |
/* op6 is compile time invariant. */ |
| 33 |
/* { dg-final { scan-ipa-dump "op6 is compile time invariant" "inline" } } */ |
| 34 |
/* op7 change. */ |
| 35 |
/* { dg-final { scan-ipa-dump-not "op7 is compile time invariant" "inline" } } */ |
| 36 |
/* { dg-final { scan-ipa-dump-not "op7 change" "inline" } } */ |