From 688a482d6359352c16efb6eee97a29894eb3ba37 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Wed, 13 Jan 2010 10:07:47 +0000 Subject: [PATCH] re PR middle-end/42678 (ICE with lto1 in expand_mult, at expmed.c:3253) 2010-01-13 Richard Guenther PR lto/42678 * tree-pass.h (PROP_gimple_lcx): New. * cfgexpand.c (pass_expand): Require PROP_gimple_lcx. * passes.c (init_optimization_passes): Move pass_lower_complex_O0 before the final cleanup_eh. (dump_properties): Dump PROP_gimple_lcx. * tree-complex.c (pass_lower_complex): Provide PROP_gimple_lcx. (tree_lower_complex_O0): Remove. (gate_no_optimization): Run if PROP_gimple_lcx is not set. (pass_lower_complex_O0): Provide PROP_gimple_lcx. Run tree_lower_complex, schedule TODO_update_ssa. * lto-streamer-out.c (output_function): Stream the functions properties. * lto-streamer-in.c (input_function): Likewise. (lto_read_body): Do not override them here. * gfortran.dg/lto/20100110-1_0.f90: New testcase. From-SVN: r155853 --- gcc/ChangeLog | 18 ++++++++++ gcc/cfgexpand.c | 3 +- gcc/lto-streamer-in.c | 11 ++---- gcc/lto-streamer-out.c | 3 ++ gcc/passes.c | 4 ++- gcc/testsuite/ChangeLog | 5 +++ .../gfortran.dg/lto/20100110-1_0.f90 | 19 +++++++++++ gcc/tree-complex.c | 34 +++++-------------- gcc/tree-pass.h | 1 + 9 files changed, 62 insertions(+), 36 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 315ebee026f..985ec60e90e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2010-01-13 Richard Guenther + + PR lto/42678 + * tree-pass.h (PROP_gimple_lcx): New. + * cfgexpand.c (pass_expand): Require PROP_gimple_lcx. + * passes.c (init_optimization_passes): Move pass_lower_complex_O0 + before the final cleanup_eh. + (dump_properties): Dump PROP_gimple_lcx. + * tree-complex.c (pass_lower_complex): Provide PROP_gimple_lcx. + (tree_lower_complex_O0): Remove. + (gate_no_optimization): Run if PROP_gimple_lcx is not set. + (pass_lower_complex_O0): Provide PROP_gimple_lcx. Run + tree_lower_complex, schedule TODO_update_ssa. + * lto-streamer-out.c (output_function): Stream the functions + properties. + * lto-streamer-in.c (input_function): Likewise. + (lto_read_body): Do not override them here. + 2010-01-12 Joseph Myers PR c/42708 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 7e542da3320..70d2b355aa1 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -3743,7 +3743,8 @@ struct rtl_opt_pass pass_expand = NULL, /* next */ 0, /* static_pass_number */ TV_EXPAND, /* tv_id */ - PROP_ssa | PROP_gimple_leh | PROP_cfg,/* properties_required */ + PROP_ssa | PROP_gimple_leh | PROP_cfg + | PROP_gimple_lcx, /* properties_required */ PROP_rtl, /* properties_provided */ PROP_ssa | PROP_trees, /* properties_destroyed */ TODO_verify_ssa | TODO_verify_flow diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index c390f272b08..f316459e083 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1291,6 +1291,9 @@ input_function (tree fn_decl, struct data_in *data_in, fn->va_list_gpr_size = bp_unpack_value (bp, 8); bitpack_delete (bp); + /* Input the current IL state of the function. */ + fn->curr_properties = lto_input_uleb128 (ib); + /* Read the static chain and non-local goto save area. */ fn->static_chain_decl = lto_input_tree (ib, data_in); fn->nonlocal_goto_save_area = lto_input_tree (ib, data_in); @@ -1466,14 +1469,6 @@ lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl, /* We should now be in SSA. */ cfun->gimple_df->in_ssa_p = true; - /* Fill in properties we know hold for the rebuilt CFG. */ - cfun->curr_properties = PROP_ssa - | PROP_cfg - | PROP_gimple_any - | PROP_gimple_lcf - | PROP_gimple_leh - | PROP_referenced_vars; - /* Restore decl state */ file_data->current_decl_state = file_data->global_decl_state; diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index fe43dcedc6b..d5431ba5a6e 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1872,6 +1872,9 @@ output_function (struct cgraph_node *node) lto_output_bitpack (ob->main_stream, bp); bitpack_delete (bp); + /* Output current IL state of the function. */ + output_uleb128 (ob, fn->curr_properties); + /* Output the static chain and non-local goto save area. */ lto_output_tree_ref (ob, fn->static_chain_decl); lto_output_tree_ref (ob, fn->nonlocal_goto_save_area); diff --git a/gcc/passes.c b/gcc/passes.c index fde3379b7c2..a04a5eff92a 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -728,7 +728,6 @@ init_optimization_passes (void) NEXT_PASS (pass_refactor_eh); NEXT_PASS (pass_lower_eh); NEXT_PASS (pass_build_cfg); - NEXT_PASS (pass_lower_complex_O0); NEXT_PASS (pass_lower_vector); NEXT_PASS (pass_warn_function_return); NEXT_PASS (pass_build_cgraph_edges); @@ -943,6 +942,7 @@ init_optimization_passes (void) NEXT_PASS (pass_uncprop); NEXT_PASS (pass_local_pure_const); } + NEXT_PASS (pass_lower_complex_O0); NEXT_PASS (pass_cleanup_eh); NEXT_PASS (pass_lower_resx); NEXT_PASS (pass_nrv); @@ -1883,6 +1883,8 @@ dump_properties (FILE *dump, unsigned int props) fprintf (dump, "PROP_rtl\n"); if (props & PROP_gimple_lomp) fprintf (dump, "PROP_gimple_lomp\n"); + if (props & PROP_gimple_lcx) + fprintf (dump, "PROP_gimple_lcx\n"); } void diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae31eae0e36..f8532afa361 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-01-13 Richard Guenther + + PR lto/42678 + * gfortran.dg/lto/20100110-1_0.f90: New testcase. + 2010-01-12 Joseph Myers PR c/42708 diff --git a/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90 b/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90 new file mode 100644 index 00000000000..d3caa61da28 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90 @@ -0,0 +1,19 @@ +! { dg-lto-do link } +! { dg-lto-options {{ -O1 -flto }} } +! { dg-suppress-ld-options "-O1" } + + SUBROUTINE ylm4(ylm) + COMPLEX, INTENT (OUT):: ylm(1) + INTEGER l,m + COMPLEX ylms + REAL, ALLOCATABLE, SAVE :: ynorm(:) + ylms = 0 + DO m = 1, 1 + DO l = m, 1 + ylm(m) = conjg(ylms)*ynorm(m) + ENDDO + ENDDO + END SUBROUTINE ylm4 + + PROGRAM test + END diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 53bf1185495..ea0a651bfea 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -1622,7 +1622,7 @@ struct gimple_opt_pass pass_lower_complex = 0, /* static_pass_number */ TV_NONE, /* tv_id */ PROP_ssa, /* properties_required */ - 0, /* properties_provided */ + PROP_gimple_lcx, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ TODO_dump_func @@ -1633,32 +1633,12 @@ struct gimple_opt_pass pass_lower_complex = }; -/* Entry point for complex operation lowering without optimization. */ - -static unsigned int -tree_lower_complex_O0 (void) -{ - int old_last_basic_block = last_basic_block; - gimple_stmt_iterator gsi; - basic_block bb; - - FOR_EACH_BB (bb) - { - if (bb->index >= old_last_basic_block) - continue; - - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - expand_complex_operations_1 (&gsi); - } - return 0; -} - static bool gate_no_optimization (void) { /* With errors, normal optimization passes are not run. If we don't lower complex operations at all, rtl expansion will abort. */ - return optimize == 0 || sorrycount || errorcount; + return !(cfun->curr_properties & PROP_gimple_lcx); } struct gimple_opt_pass pass_lower_complex_O0 = @@ -1667,16 +1647,18 @@ struct gimple_opt_pass pass_lower_complex_O0 = GIMPLE_PASS, "cplxlower0", /* name */ gate_no_optimization, /* gate */ - tree_lower_complex_O0, /* execute */ + tree_lower_complex, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ TV_NONE, /* tv_id */ PROP_cfg, /* properties_required */ - 0, /* properties_provided */ + PROP_gimple_lcx, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - TODO_dump_func | TODO_ggc_collect - | TODO_verify_stmts, /* todo_flags_finish */ + TODO_dump_func + | TODO_ggc_collect + | TODO_update_ssa + | TODO_verify_stmts /* todo_flags_finish */ } }; diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 40cfb0f6891..383a164004c 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -226,6 +226,7 @@ struct dump_file_info #define PROP_rtl (1 << 7) #define PROP_gimple_lomp (1 << 8) /* lowered OpenMP directives */ #define PROP_cfglayout (1 << 9) /* cfglayout mode on RTL */ +#define PROP_gimple_lcx (1 << 10) /* lowered complex */ #define PROP_trees \ (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)