| 1 |
/* { dg-options "-O2 -fdump-ipa-inline-details -fno-early-inlining " } */ |
| 2 |
/* { dg-add-options bind_pic_locally } */ |
| 3 |
int j,k,l; |
| 4 |
int test3(int); |
| 5 |
int test4(int); |
| 6 |
|
| 7 |
static inline int |
| 8 |
test2(int i) |
| 9 |
{ |
| 10 |
if (__builtin_constant_p (i)) |
| 11 |
{ |
| 12 |
switch (i) |
| 13 |
{ |
| 14 |
case 1: return j; |
| 15 |
case 2: return k; |
| 16 |
case 3: return l; |
| 17 |
} |
| 18 |
} |
| 19 |
else return test3(i)+test4(i); |
| 20 |
} |
| 21 |
|
| 22 |
static inline int |
| 23 |
test (int i) |
| 24 |
{ |
| 25 |
return test2(i) + test2(i+1) + test3 (i) + test3(i) + test3(i) + test3 (i); |
| 26 |
} |
| 27 |
|
| 28 |
int |
| 29 |
run (int i) |
| 30 |
{ |
| 31 |
return test (i) + test (i); |
| 32 |
} |
| 33 |
/* The test should work by first inlining test2->test and then test to run |
| 34 |
Both are called twice, so 4 hints (the second make sure that we propagate |
| 35 |
to callers. */ |
| 36 |
/* { dg-final { scan-ipa-dump-times "hints: declared_inline builtin_constant_p" 4 "inline" } } */ |