From 0d21c2a2fe90663ddb7bbfa346107a0706a705c1 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 18 Apr 2005 06:10:45 +0000 Subject: re PR tree-optimization/21001 (VRP is weak when the tested variable in a COND_EXPR is used only in the COND_EXPR.) gcc/ PR tree-optimization/21001 * tree-optimize.c (init_tree_optimization_passes): Move the first pass_forwprop immediately before pass_vrp. testsuite/ PR tree-optimization/21001 * gcc.dg/tree-ssa/pr21001.c: New. From-SVN: r98309 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr21001.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr21001.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b683caf..b4e22d5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-18 Kazu Hirata + + PR tree-optimization/21001 + * gcc.dg/tree-ssa/pr21001.c: New. + 2005-04-17 Thomas Koenig PR libfortran/21075 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 0000000..c274cd3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c @@ -0,0 +1,20 @@ +/* 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-vrp-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 "vrp"} } */ -- cgit v1.1