| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
/* Test for CPROP across a DAG. */ |
| 5 |
|
| 6 |
int test111 (int param) |
| 7 |
{ |
| 8 |
int a, b, c; |
| 9 |
if (param) { |
| 10 |
a = 3; |
| 11 |
b = 2; |
| 12 |
} |
| 13 |
else { |
| 14 |
a = 2; |
| 15 |
b = 3; |
| 16 |
} |
| 17 |
c = a + b; |
| 18 |
if (c != 5) |
| 19 |
return 2; |
| 20 |
return 0; |
| 21 |
} |
| 22 |
|
| 23 |
int test1111 (int param) |
| 24 |
{ |
| 25 |
_Bool a, b, c; |
| 26 |
if (param) { |
| 27 |
a = 1; |
| 28 |
b = 0; |
| 29 |
} |
| 30 |
else { |
| 31 |
a = 0; |
| 32 |
b = 1; |
| 33 |
} |
| 34 |
c = a && b; |
| 35 |
if (c) |
| 36 |
return 2; |
| 37 |
return 0; |
| 38 |
} |
| 39 |
|
| 40 |
/* All ifs should be eliminated. */ |
| 41 |
/* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */ |