| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fipa-sra" } */ |
| 3 |
|
| 4 |
struct W |
| 5 |
{ |
| 6 |
int a, b; |
| 7 |
}; |
| 8 |
|
| 9 |
union U |
| 10 |
{ |
| 11 |
struct W w; |
| 12 |
long l; |
| 13 |
}; |
| 14 |
|
| 15 |
struct Z |
| 16 |
{ |
| 17 |
int k; |
| 18 |
union U u; |
| 19 |
}; |
| 20 |
|
| 21 |
struct S |
| 22 |
{ |
| 23 |
int i, j; |
| 24 |
struct Z z; |
| 25 |
char buf[64]; |
| 26 |
}; |
| 27 |
|
| 28 |
struct W gw; |
| 29 |
|
| 30 |
|
| 31 |
static long |
| 32 |
__attribute__((noinline)) |
| 33 |
foo (struct Z z) |
| 34 |
{ |
| 35 |
return z.u.l; |
| 36 |
} |
| 37 |
|
| 38 |
static long |
| 39 |
__attribute__((noinline)) |
| 40 |
bar (struct S s) |
| 41 |
{ |
| 42 |
if (s.i > 100) |
| 43 |
return s.z.u.w.a; |
| 44 |
else |
| 45 |
return foo (s.z); |
| 46 |
} |
| 47 |
|
| 48 |
volatile long g; |
| 49 |
|
| 50 |
long |
| 51 |
entry (struct S *p) |
| 52 |
{ |
| 53 |
struct S s = *p; |
| 54 |
|
| 55 |
return bar (s) | 2; |
| 56 |
} |