From f2b01cfb6dcbf8dd471eee611d26c0cf094683f5 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Thu, 4 Nov 2010 15:19:19 +0000 Subject: [PATCH] re PR tree-optimization/46183 (ICE: in calc_dfs_tree, at dominance.c:396 with -O -fno-dse -fgcse -ftree-pre) 2010-11-04 Richard Guenther PR rtl-optimization/46183 * gcse.c (execute_rtl_cprop): Cleanup the CFG if something changed. (execute_rtl_pre): Likewise. (execute_rtl_hoist): Likewise. * gcc.dg/torture/pr46183.c: New testcase. From-SVN: r166316 --- gcc/ChangeLog | 7 +++++++ gcc/gcse.c | 18 +++++++++++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr46183.c | 20 ++++++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr46183.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 206f860fe04d..71bd8b4edc3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-11-04 Richard Guenther + + PR rtl-optimization/46183 + * gcse.c (execute_rtl_cprop): Cleanup the CFG if something changed. + (execute_rtl_pre): Likewise. + (execute_rtl_hoist): Likewise. + 2010-11-04 Richard Guenther PR tree-optimization/46068 diff --git a/gcc/gcse.c b/gcc/gcse.c index 70f0fac0ed4a..595fdb2b054e 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -5246,10 +5246,14 @@ gate_rtl_cprop (void) static unsigned int execute_rtl_cprop (void) { + int changed; delete_unreachable_blocks (); df_set_flags (DF_LR_RUN_DCE); df_analyze (); - flag_rerun_cse_after_global_opts |= one_cprop_pass (); + changed = one_cprop_pass (); + flag_rerun_cse_after_global_opts |= changed; + if (changed) + cleanup_cfg (0); return 0; } @@ -5265,9 +5269,13 @@ gate_rtl_pre (void) static unsigned int execute_rtl_pre (void) { + int changed; delete_unreachable_blocks (); df_analyze (); - flag_rerun_cse_after_global_opts |= one_pre_gcse_pass (); + changed = one_pre_gcse_pass (); + flag_rerun_cse_after_global_opts |= changed; + if (changed) + cleanup_cfg (0); return 0; } @@ -5286,9 +5294,13 @@ gate_rtl_hoist (void) static unsigned int execute_rtl_hoist (void) { + int changed; delete_unreachable_blocks (); df_analyze (); - flag_rerun_cse_after_global_opts |= one_code_hoisting_pass (); + changed = one_code_hoisting_pass (); + flag_rerun_cse_after_global_opts |= changed; + if (changed) + cleanup_cfg (0); return 0; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e2179c7050d0..6928ea0b1840 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-04 Richard Guenther + + PR rtl-optimization/46183 + * gcc.dg/torture/pr46183.c: New testcase. + 2010-11-04 Richard Guenther PR tree-optimization/46068 diff --git a/gcc/testsuite/gcc.dg/torture/pr46183.c b/gcc/testsuite/gcc.dg/torture/pr46183.c new file mode 100644 index 000000000000..9582c34e0842 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr46183.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-dse" } */ + +void bar(void); + +void foo (int i, ...) +{ + __builtin_va_list ap; + __builtin_va_start (ap, i); + __builtin_va_arg (ap, int); + while (i) i++; + __builtin_va_arg (ap, int); + while (i) i++; + __builtin_va_arg (ap, int); + while (i) i++; + __builtin_va_arg (ap, int); + if (i) + bar (); +} +