| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -funswitch-loops -fdump-tree-unswitch-blocks-details" } */ |
| 3 |
|
| 4 |
int bla(int p) |
| 5 |
{ |
| 6 |
unsigned i, s = 1; |
| 7 |
|
| 8 |
for (i = 4; i < 100; i++) |
| 9 |
{ |
| 10 |
if (p) |
| 11 |
s += i/2; |
| 12 |
else |
| 13 |
s *= i/2; |
| 14 |
} |
| 15 |
|
| 16 |
return s; |
| 17 |
} |
| 18 |
|
| 19 |
/* We used to make the probability that the first of the loops created |
| 20 |
by unswitching is entered 100%, which is not correct. */ |
| 21 |
|
| 22 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "unswitch"} } */ |
| 23 |
/* { dg-final { scan-tree-dump-not "SUCC: 3 .100.0%" "unswitch"} } */ |