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. */
foo(long * p,long * p2,int N1,int N2)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 while (i < N1)
12 {
13 p++;
14 p2++;
15 i++;
16 if (p2 > p_limit2)
17 break;
18 s += (*p);
19 }
20
21 return s;
22 }
23
24 /* { dg-final { scan-tree-dump-times "Replacing" 2 "ivopts"} } */
25