diff options
author | Richard Biener <rguenther@suse.de> | 2015-03-13 08:47:14 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-03-13 08:47:14 +0000 |
commit | 2a5671ee800de5ace6b9d78cd47de73a04d92fa8 (patch) | |
tree | b652e843afc3a6d9186d29d95bbeae5f778cee40 /gcc/tree-ssa-propagate.c | |
parent | 10ac6596183f0ffa298688791bac6a232f351214 (diff) | |
download | gcc-2a5671ee800de5ace6b9d78cd47de73a04d92fa8.zip gcc-2a5671ee800de5ace6b9d78cd47de73a04d92fa8.tar.gz gcc-2a5671ee800de5ace6b9d78cd47de73a04d92fa8.tar.bz2 |
re PR ipa/44563 (GCC uses a lot of RAM when compiling a large numbers of functions)
2015-03-10 Richard Biener <rguenther@suse.de>
PR middle-end/44563
* tree-cfgcleanup.c (split_bb_on_noreturn_calls): Remove.
(cleanup_tree_cfg_1): Do not call it.
(execute_cleanup_cfg_post_optimizing): Fixup the CFG here.
(fixup_noreturn_call): Mark the stmt as control altering.
* tree-cfg.c (execute_fixup_cfg): Do not dump the function
here.
(pass_data_fixup_cfg): Produce a dump file.
* tree-ssa-dom.c: Include tree-cfgcleanup.h.
(need_noreturn_fixup): New global.
(pass_dominator::execute): Fixup queued noreturn calls.
(optimize_stmt): Queue calls that became noreturn for fixup.
* tree-ssa-forwprop.c (pass_forwprop::execute): Likewise.
* tree-ssa-pre.c: Include tree-cfgcleanup.h.
(el_to_fixup): New global.
(eliminate_dom_walker::before_dom_childre): Queue calls that
became noreturn for fixup.
(eliminate): Fixup queued noreturn calls.
* tree-ssa-propagate.c: Include tree-cfgcleanup.h.
(substitute_and_fold_dom_walker): New member stmts_to_fixup.
(substitute_and_fold_dom_walker::before_dom_children): Queue
alls that became noreturn for fixup.
(substitute_and_fold): Fixup queued noreturn calls.
From-SVN: r221409
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 8b82f9e..c3f9d3e 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -67,6 +67,7 @@ #include "value-prof.h" #include "domwalk.h" #include "cfgloop.h" +#include "tree-cfgcleanup.h" /* This file implements a generic value propagation engine based on the same propagation used by the SSA-CCP algorithm [1]. @@ -1071,11 +1072,13 @@ public: fold_fn (fold_fn_), do_dce (do_dce_), something_changed (false) { stmts_to_remove.create (0); + stmts_to_fixup.create (0); need_eh_cleanup = BITMAP_ALLOC (NULL); } ~substitute_and_fold_dom_walker () { stmts_to_remove.release (); + stmts_to_fixup.release (); BITMAP_FREE (need_eh_cleanup); } @@ -1087,6 +1090,7 @@ public: bool do_dce; bool something_changed; vec<gimple> stmts_to_remove; + vec<gimple> stmts_to_fixup; bitmap need_eh_cleanup; }; @@ -1125,7 +1129,6 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) { bool did_replace; gimple stmt = gsi_stmt (i); - gimple old_stmt; enum gimple_code code = gimple_code (stmt); /* Ignore ASSERT_EXPRs. They are used by VRP to generate @@ -1163,7 +1166,9 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); } - old_stmt = stmt; + gimple old_stmt = stmt; + bool was_noreturn = (is_gimple_call (stmt) + && gimple_call_noreturn_p (stmt)); /* Some statements may be simplified using propagator specific information. Do this before propagating @@ -1194,6 +1199,13 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)) bitmap_set_bit (need_eh_cleanup, bb->index); + /* If we turned a not noreturn call into a noreturn one + schedule it for fixup. */ + if (!was_noreturn + && is_gimple_call (stmt) + && gimple_call_noreturn_p (stmt)) + stmts_to_fixup.safe_push (stmt); + if (is_gimple_assign (stmt) && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)) == GIMPLE_SINGLE_RHS)) @@ -1286,6 +1298,22 @@ substitute_and_fold (ssa_prop_get_value_fn get_value_fn, if (!bitmap_empty_p (walker.need_eh_cleanup)) gimple_purge_all_dead_eh_edges (walker.need_eh_cleanup); + /* Fixup stmts that became noreturn calls. This may require splitting + blocks and thus isn't possible during the dominator walk. Do this + in reverse order so we don't inadvertedly remove a stmt we want to + fixup by visiting a dominating now noreturn call first. */ + while (!walker.stmts_to_fixup.is_empty ()) + { + gimple stmt = walker.stmts_to_fixup.pop (); + if (dump_file && dump_flags & TDF_DETAILS) + { + fprintf (dump_file, "Fixing up noreturn call "); + print_gimple_stmt (dump_file, stmt, 0, 0); + fprintf (dump_file, "\n"); + } + fixup_noreturn_call (stmt); + } + statistics_counter_event (cfun, "Constants propagated", prop_stats.num_const_prop); statistics_counter_event (cfun, "Copies propagated", |