| 1 |
/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ |
| 2 |
/* { dg-options "-O2 -m64 -fdump-tree-ivopts-details" } */ |
| 3 |
|
| 4 |
/* Exit tests 'i < N1' and 'p2 > p_limit2' can be replaced, so |
| 5 |
* two ivs i and p2 can be eliminate. */ |
| 6 |
long foo(long* p, long* p2, int N1, int N2) |
| 7 |
{ |
| 8 |
int i = 0; |
| 9 |
long* p_limit2 = p2 + N2; |
| 10 |
long s = 0; |
| 11 |
if (p2 <= p_limit2) |
| 12 |
while (i < N1) |
| 13 |
{ |
| 14 |
p++; |
| 15 |
p2++; |
| 16 |
i++; |
| 17 |
if (p2 > p_limit2) |
| 18 |
break; |
| 19 |
s += (*p); |
| 20 |
} |
| 21 |
|
| 22 |
return s; |
| 23 |
} |
| 24 |
|
| 25 |
/* { dg-final { scan-tree-dump-times "Replacing" 2 "ivopts" } } */ |