diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr21001.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr21001.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c new file mode 100644 index 000000000..84280b39c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/21001 + VRP did not insert ASSERT_EXPRs when the variable tested in a + COND_EXPR is a single-use variable. By propagating the definition + of the single-use variable into the COND_EXPR, we can get useful + range infomation out of the conditional. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ + +int +foo (int a) +{ + int b = a != 0; + if (b) + if (a != 0) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ |