| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-ipa-cp-details -fdump-tree-vrp1" } */ |
| 3 |
|
| 4 |
static __attribute__((noinline, noclone)) |
| 5 |
int foo (int *p) |
| 6 |
{ |
| 7 |
if (!p) |
| 8 |
return 0; |
| 9 |
*p = 1; |
| 10 |
} |
| 11 |
|
| 12 |
struct st |
| 13 |
{ |
| 14 |
int a; |
| 15 |
int b; |
| 16 |
}; |
| 17 |
|
| 18 |
struct st s2; |
| 19 |
int a; |
| 20 |
int bar (struct st *s) |
| 21 |
{ |
| 22 |
struct st s3; |
| 23 |
int b; |
| 24 |
if (!s) |
| 25 |
return 0; |
| 26 |
foo (&s->a); |
| 27 |
foo (&s2.a); |
| 28 |
foo (&s3.a); |
| 29 |
foo (&a); |
| 30 |
foo (&b); |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-ipa-dump "Setting value range.* \\\[1, \\+INF\\\]" "cp" } } */ |
| 34 |
/* { dg-final { scan-tree-dump-times "if" 1 "vrp1" } } */ |