| 1 |
/* PR tree-optimization/21001 |
| 2 |
VRP did not insert ASSERT_EXPRs when the variable tested in a |
| 3 |
COND_EXPR is a single-use variable. By propagating the definition |
| 4 |
of the single-use variable into the COND_EXPR, we can get useful |
| 5 |
range information out of the conditional. */ |
| 6 |
|
| 7 |
/* { dg-do compile } */ |
| 8 |
/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fno-thread-jumps -fdump-tree-vrp1-details" } */ |
| 9 |
/* { dg-additional-options "-fdisable-tree-ethread -fdisable-tree-thread1" } */ |
| 10 |
|
| 11 |
int |
| 12 |
foo (int a) |
| 13 |
{ |
| 14 |
int b = a != 0; |
| 15 |
if (b) |
| 16 |
if (a != 0) |
| 17 |
return 1; |
| 18 |
return 0; |
| 19 |
} |
| 20 |
|
| 21 |
/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ |