| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-optimized --param max-unswitch-insns=100" } */ |
| 3 |
|
| 4 |
void bar (int); |
| 5 |
void foo (int a, int b, int c, int n) |
| 6 |
{ |
| 7 |
for (int i = 0; i < n; ++i) |
| 8 |
{ |
| 9 |
if (a > 5) |
| 10 |
bar (1); |
| 11 |
if (b < 10) |
| 12 |
bar (2); |
| 13 |
if (c != 5) |
| 14 |
bar (3); |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
/* Verify we can unswitch all permutations of the predicates. */ |
| 19 |
/* { dg-final { scan-tree-dump-times "unswitching loop . on .if. with condition" 7 "unswitch" } } */ |
| 20 |
/* { dg-final { scan-tree-dump "unswitching loop . on .if. with condition: a" "unswitch" } } */ |
| 21 |
/* { dg-final { scan-tree-dump "unswitching loop . on .if. with condition: b" "unswitch" } } */ |
| 22 |
/* { dg-final { scan-tree-dump "unswitching loop . on .if. with condition: c" "unswitch" } } */ |