| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-O2 -fdump-ipa-icf-optimized" } */ |
| 3 |
|
| 4 |
/* Picking 'main' as a candiate target for equivalent functios is not a |
| 5 |
good idea. */ |
| 6 |
|
| 7 |
int baz (int); |
| 8 |
|
| 9 |
int foo () |
| 10 |
{ |
| 11 |
return baz (baz (0)); |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
int main () |
| 16 |
{ |
| 17 |
return baz (baz (0)); |
| 18 |
} |
| 19 |
|
| 20 |
/* Notice the two functions are the same. */ |
| 21 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:foo/\[0-9+\]+->main/\[0-9+\]+" "icf" } } */ |
| 22 |
|
| 23 |
/* Make sure we don't tail call main. */ |
| 24 |
/* { dg-final { scan-ipa-dump-not "= main \\(\\);" "icf" } } */ |
| 25 |
|
| 26 |
/* Make sure we tail call foo. */ |
| 27 |
/* { dg-final { scan-ipa-dump "= foo \\(\\);" "icf" } } */ |