gcc/testsuite/g++.dg/pr105276.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 | |
| 4 | bool |
| 5 | foo(unsigned i) |
| 6 | { |
| 7 | bool result = true; |
| 8 | while (i) |
| 9 | { |
| 10 | i = i % 3; |
| 11 | i = i - (i == 2 ? 2 : i ? 1 : 0); |
| 12 | result = !result; |
| 13 | } |
| 14 | return result; |
| 15 | } |
| 16 | |
| 17 | /* We should be able to eliminate the i - operation. */ |
| 18 | /* { dg-final { scan-tree-dump-not "i_.* - " "optimized" } } */ |