| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-cddce1" } */ |
| 3 |
|
| 4 |
int main(void) |
| 5 |
{ |
| 6 |
unsigned i, j; |
| 7 |
|
| 8 |
for (i = 1, j = 0; i != 0; i+=2) |
| 9 |
{ |
| 10 |
j += 500; |
| 11 |
if (j % 7) |
| 12 |
{ |
| 13 |
j++; |
| 14 |
} |
| 15 |
else |
| 16 |
{ |
| 17 |
j--; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
return 0; |
| 22 |
} |
| 23 |
|
| 24 |
/* We now can prove the infiniteness of the loop during CCP but we |
| 25 |
still want to eliminate the code inside the infinite loop. See PR45178. */ |
| 26 |
|
| 27 |
/* We should eliminate the inner condition, but the loop must be preserved |
| 28 |
as it is infinite. Therefore there should be just one goto and no PHI |
| 29 |
and no if. */ |
| 30 |
/* { dg-final { scan-tree-dump-times "PHI " 0 "cddce1" } } */ |
| 31 |
/* { dg-final { scan-tree-dump-times "if " 0 "cddce1" } } */ |
| 32 |
/* { dg-final { scan-tree-dump-times "goto" 1 "cddce1" } } */ |