| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */ |
| 3 |
|
| 4 |
/* Check of a simple and transitive structure split. */ |
| 5 |
|
| 6 |
struct S |
| 7 |
{ |
| 8 |
float red; |
| 9 |
void *blue; |
| 10 |
int green; |
| 11 |
}; |
| 12 |
|
| 13 |
|
| 14 |
void __attribute__((noipa)) |
| 15 |
check (float r, int g, int g2) |
| 16 |
{ |
| 17 |
if (r < 7.39 || r > 7.41 |
| 18 |
|| g != 6 || g2 != 6) |
| 19 |
__builtin_abort (); |
| 20 |
} |
| 21 |
|
| 22 |
static void |
| 23 |
__attribute__((noinline)) |
| 24 |
foo (struct S s) |
| 25 |
{ |
| 26 |
check (s.red, s.green, s.green); |
| 27 |
} |
| 28 |
|
| 29 |
static void |
| 30 |
__attribute__((noinline)) |
| 31 |
bar (struct S s) |
| 32 |
{ |
| 33 |
foo (s); |
| 34 |
} |
| 35 |
|
| 36 |
int |
| 37 |
main (int argc, char **argv) |
| 38 |
{ |
| 39 |
struct S s; |
| 40 |
|
| 41 |
s.red = 7.4; |
| 42 |
s.green = 6; |
| 43 |
s.blue = &s; |
| 44 |
|
| 45 |
bar (s); |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
/* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" { xfail { hppa*-*-hpux* && { ! lp64 } } } } } */ |
| 50 |
/* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" { xfail { hppa*-*-hpux* && { ! lp64 } } } } } */ |