| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fdump-tree-phiopt2 -fdump-tree-optimized --param logical-op-non-short-circuit=1" } */ |
| 3 |
|
| 4 |
int f(int a, int b, int c) |
| 5 |
{ |
| 6 |
if (a == 0 && b > c) |
| 7 |
return 0; |
| 8 |
return a; |
| 9 |
} |
| 10 |
|
| 11 |
int g(int a, int b, int c) |
| 12 |
{ |
| 13 |
if (a == 42 && b > c) |
| 14 |
return 42; |
| 15 |
return a; |
| 16 |
} |
| 17 |
|
| 18 |
int h(int a, int b, int c, int d) |
| 19 |
{ |
| 20 |
if (a == d && b > c) |
| 21 |
return d; |
| 22 |
return a; |
| 23 |
} |
| 24 |
|
| 25 |
int i(int a, int b, int c) |
| 26 |
{ |
| 27 |
if ((a > c) & (a == b)) |
| 28 |
return a; |
| 29 |
return b; |
| 30 |
} |
| 31 |
|
| 32 |
int j(int a, int b, int c) |
| 33 |
{ |
| 34 |
if ((a > c) & (a == b)) |
| 35 |
return b; |
| 36 |
return a; |
| 37 |
} |
| 38 |
|
| 39 |
int k(int a, int b, int c) |
| 40 |
{ |
| 41 |
if ((a > c) | (a != b)) |
| 42 |
return b; |
| 43 |
return a; |
| 44 |
} |
| 45 |
|
| 46 |
int l(int a, int b, int c) |
| 47 |
{ |
| 48 |
if ((a > c) | (a != b)) |
| 49 |
return a; |
| 50 |
return b; |
| 51 |
} |
| 52 |
|
| 53 |
/* { dg-final { scan-tree-dump-times "if" 0 "phiopt2" } } */ |
| 54 |
/* { dg-final { scan-tree-dump-times "if" 0 "optimized" } } */ |