| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fno-tree-sra -fdump-tree-cddce1" } */ |
| 3 |
|
| 4 |
extern int posix_memalign(void **memptr, |
| 5 |
__SIZE_TYPE__ alignment, __SIZE_TYPE__ size); |
| 6 |
|
| 7 |
int foo (float *p) |
| 8 |
{ |
| 9 |
int res = *p; |
| 10 |
struct { void *q1; void *q2; } q; |
| 11 |
if (posix_memalign (&q.q1, 128, 128 * sizeof (int)) != 0) |
| 12 |
return 0; |
| 13 |
if (posix_memalign (&q.q2, 128, 128 * sizeof (int)) != 0) |
| 14 |
return 0; |
| 15 |
*((int *)q.q1) = 1; |
| 16 |
*((int *)q.q2) = 2; |
| 17 |
return res + *p + *((int *)q.q1) + *((int *)q.q2); |
| 18 |
} |
| 19 |
|
| 20 |
/* There should be only one load from *p left. All stores and all |
| 21 |
other loads should be removed. */ |
| 22 |
|
| 23 |
/* { dg-final { scan-tree-dump-times "\\\*\[^ \]" 1 "cddce1" } } */ |