| 1 |
/* Verify that simple indirect calls are inlined even without early |
| 2 |
inlining.. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */ |
| 5 |
/* { dg-add-options bind_pic_locally } */ |
| 6 |
|
| 7 |
extern void non_existent (const char *, int); |
| 8 |
|
| 9 |
class String |
| 10 |
{ |
| 11 |
private: |
| 12 |
const char *data; |
| 13 |
|
| 14 |
public: |
| 15 |
String (const char *d) : data(d) |
| 16 |
{} |
| 17 |
|
| 18 |
int funcOne (int delim) const; |
| 19 |
int printStuffTwice (int delim) const; |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
int String::funcOne (int delim) const |
| 24 |
{ |
| 25 |
int i; |
| 26 |
for (i = 0; i < delim; i++) |
| 27 |
non_existent(data, i); |
| 28 |
|
| 29 |
return 1; |
| 30 |
} |
| 31 |
|
| 32 |
int docalling (int (String::* f)(int delim) const) |
| 33 |
{ |
| 34 |
String S ("muhehehe"); |
| 35 |
|
| 36 |
return (S.*f)(4); |
| 37 |
} |
| 38 |
|
| 39 |
int main (int argc, char *argv[]) |
| 40 |
{ |
| 41 |
int i = 0; |
| 42 |
while (i < 1000) |
| 43 |
i += docalling (&String::funcOne); |
| 44 |
non_existent ("done", i); |
| 45 |
return 0; |
| 46 |
} |
| 47 |
|
| 48 |
/* { dg-final { scan-ipa-dump "String::funcOne\[^\\n\]*inline copy in int main" "inline" } } */ |