From f67c86a6e88bebfc3b1e56df9ccde8165a1b9d67 Mon Sep 17 00:00:00 2001 From: kazu Date: Mon, 18 Apr 2005 06:10:45 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98309 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr21001.c | 20 ++++++++++++++++++++ gcc/tree-optimize.c | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr21001.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64c39f9ece0..8a70d696f8a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-04-18 Kazu Hirata + + PR tree-optimization/21001 + * tree-optimize.c (init_tree_optimization_passes): Move the + first pass_forwprop immediately before pass_vrp. + 2005-04-17 Ian Lance Taylor * c-common.def (SIZEOF_EXPR, ARROW_EXPR, ALIGNOF_EXPR): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b683caf4110..b4e22d52749 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 00000000000..c274cd3385e --- /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"} } */ diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 4d172c292d6..2284a798302 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -356,9 +356,9 @@ init_tree_optimization_passes (void) NEXT_PASS (pass_dominator); NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_dce); + NEXT_PASS (pass_forwprop); NEXT_PASS (pass_vrp); NEXT_PASS (pass_merge_phi); - NEXT_PASS (pass_forwprop); NEXT_PASS (pass_phiopt); NEXT_PASS (pass_may_alias); NEXT_PASS (pass_tail_recursion); -- 2.11.0