| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-ipa-icf-optimized" } */ |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
|
| 6 |
struct container |
| 7 |
{ |
| 8 |
int x; |
| 9 |
int y; |
| 10 |
}; |
| 11 |
|
| 12 |
static struct container max; |
| 13 |
static int array[3][3]; |
| 14 |
static int array2[123]; |
| 15 |
|
| 16 |
__attribute__ ((noinline)) |
| 17 |
void foo(void) |
| 18 |
{ |
| 19 |
printf("Foo()"); |
| 20 |
} |
| 21 |
|
| 22 |
__attribute__ ((noinline)) |
| 23 |
int order(int x, int y) |
| 24 |
{ |
| 25 |
return x < y ? 2 : 4; |
| 26 |
} |
| 27 |
|
| 28 |
__attribute__ ((noinline)) |
| 29 |
int order2(int y, int x) |
| 30 |
{ |
| 31 |
return x < y ? 2 : 4; |
| 32 |
} |
| 33 |
|
| 34 |
__attribute__ ((noinline)) |
| 35 |
void x1(int x) |
| 36 |
{ |
| 37 |
int i; |
| 38 |
for(i = 0; i < 20; ++i) |
| 39 |
array2[i] = i; |
| 40 |
|
| 41 |
array2[2] = 13; |
| 42 |
} |
| 43 |
|
| 44 |
__attribute__ ((noinline)) |
| 45 |
void x2(int a) |
| 46 |
{ |
| 47 |
int i; |
| 48 |
for(i = 0; i < 20; ++i) |
| 49 |
array2[i] = i; |
| 50 |
|
| 51 |
array2[2] = 13; |
| 52 |
} |
| 53 |
|
| 54 |
int main(int argc, char **argv) |
| 55 |
{ |
| 56 |
return 0; |
| 57 |
} |
| 58 |
|
| 59 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:x1/\[0-9+\]+->x2/\[0-9+\]+" "icf" } } */ |
| 60 |
/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */ |