| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-ipa-icf-optimized-all -fno-ipa-vrp" } */ |
| 3 |
|
| 4 |
static int zip(); |
| 5 |
static int zap(); |
| 6 |
static int two(); |
| 7 |
|
| 8 |
__attribute__ ((noinline)) |
| 9 |
int foo() |
| 10 |
{ |
| 11 |
return zip(); |
| 12 |
} |
| 13 |
|
| 14 |
__attribute__ ((noinline)) |
| 15 |
int bar() |
| 16 |
{ |
| 17 |
return zap(); |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__ ((noinline)) |
| 21 |
int baz() |
| 22 |
{ |
| 23 |
return two(); |
| 24 |
} |
| 25 |
|
| 26 |
__attribute__ ((noinline)) |
| 27 |
int zip() |
| 28 |
{ |
| 29 |
return 0; |
| 30 |
} |
| 31 |
|
| 32 |
__attribute__ ((noinline)) |
| 33 |
int zap() |
| 34 |
{ |
| 35 |
return 0; |
| 36 |
} |
| 37 |
|
| 38 |
__attribute__ ((noinline)) |
| 39 |
int two() |
| 40 |
{ |
| 41 |
return 2; |
| 42 |
} |
| 43 |
|
| 44 |
int main() |
| 45 |
{ |
| 46 |
return foo() + bar(); |
| 47 |
} |
| 48 |
|
| 49 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:foo/\[0-9+\]+->bar/\[0-9+\]+" "icf" } } */ |
| 50 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:zip/\[0-9+\]+->zap/\[0-9+\]+" "icf" } } */ |
| 51 |
/* { dg-final { scan-ipa-dump "Equal symbols: 2" "icf" } } */ |