| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-ipa-icf-optimized" } */ |
| 3 |
|
| 4 |
static int a; |
| 5 |
static int b; |
| 6 |
static const int c = 2; |
| 7 |
static const int d = 2; |
| 8 |
static char * e = "test"; |
| 9 |
static char * f = "test"; |
| 10 |
static int g[3]={1,2,3}; |
| 11 |
static int h[3]={1,2,3}; |
| 12 |
static const int *i=&c; |
| 13 |
static const int *j=&c; |
| 14 |
static const int *k=&d; |
| 15 |
int t(int tt) |
| 16 |
{ |
| 17 |
switch (tt) |
| 18 |
{ |
| 19 |
case 1: return a; |
| 20 |
case 2: return b; |
| 21 |
case 3: return c; |
| 22 |
case 4: return d; |
| 23 |
case 5: return e[1]; |
| 24 |
case 6: return f[1]; |
| 25 |
case 7: return g[1]; |
| 26 |
case 8: return h[1]; |
| 27 |
case 9: return i[0]; |
| 28 |
case 10: return j[0]; |
| 29 |
case 11: return k[0]; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-ipa-dump "Equal symbols: 5" "icf" } } */ |
| 34 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:a/\[0-9+\]+->b/\[0-9+\]+" "icf" } } */ |
| 35 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:c/\[0-9+\]+->d/\[0-9+\]+" "icf" } } */ |
| 36 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:e/\[0-9+\]+->f/\[0-9+\]+" "icf" } } */ |
| 37 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:g/\[0-9+\]+->h/\[0-9+\]+" "icf" } } */ |
| 38 |
/* { dg-final { scan-ipa-dump "Semantic equality hit:i/\[0-9+\]+->j/\[0-9+\]+" "icf" } } */ |