diff options
author | Jan Hubicka <jh@suse.cz> | 2020-10-22 17:32:32 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-10-22 17:32:32 +0200 |
commit | 0e590b68fa3743656f40aee8374b788b108350c7 (patch) | |
tree | 1183a176f4543e9e141d2a2657e1212e6f1dc7af /gcc/ipa-inline-transform.c | |
parent | c26d7df103197e52dcd6edbb9a7f58eafdd6c715 (diff) | |
download | gcc-0e590b68fa3743656f40aee8374b788b108350c7.zip gcc-0e590b68fa3743656f40aee8374b788b108350c7.tar.gz gcc-0e590b68fa3743656f40aee8374b788b108350c7.tar.bz2 |
Materialize clones on demand
this patch removes the pass to materialize all clones and instead this
is now done on demand. The motivation is to reduce lifetime of function
bodies in ltrans that should noticeably reduce memory use for highly
parallel compilations of large programs (like Martin does) or with
partitioning reduced/disabled. For cc1 with one partition the memory use
seems to go down from 4gb to cca 1.5gb (seeing from top, so this is not
particularly accurate).
gcc/ChangeLog:
2020-10-22 Jan Hubicka <hubicka@ucw.cz>
* cgraph.c (cgraph_node::get_untransformed_body): Perform lazy
clone materialization.
* cgraph.h (cgraph_node::materialize_clone): Declare.
(symbol_table::materialize_all_clones): Remove.
* cgraphclones.c (cgraph_materialize_clone): Turn to ...
(cgraph_node::materialize_clone): .. this one; move here
dumping from symbol_table::materialize_all_clones.
(symbol_table::materialize_all_clones): Remove.
* cgraphunit.c (mark_functions_to_output): Clear stmt references.
(cgraph_node::expand): Initialize bitmaps early;
do not call execute_all_ipa_transforms if there are no transforms.
* ipa-inline-transform.c (save_inline_function_body): Fix formating.
(inline_transform): Materialize all clones before function is modified.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call):
Materialize clone if needed.
* ipa.c (class pass_materialize_all_clones): Remove.
(make_pass_materialize_all_clones): Remove.
* passes.c (execute_all_ipa_transforms): Materialize all clones.
* passes.def: Remove pass_materialize_all_clones.
* tree-pass.h (make_pass_materialize_all_clones): Remove.
* tree-ssa-structalias.c (ipa_pta_execute): Clear refs.
Diffstat (limited to 'gcc/ipa-inline-transform.c')
-rw-r--r-- | gcc/ipa-inline-transform.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c index af2c285..f419df0 100644 --- a/gcc/ipa-inline-transform.c +++ b/gcc/ipa-inline-transform.c @@ -644,16 +644,16 @@ save_inline_function_body (struct cgraph_node *node) tree_function_versioning (node->decl, first_clone->decl, NULL, NULL, true, NULL, NULL); - /* The function will be short lived and removed after we inline all the clones, - but make it internal so we won't confuse ourself. */ + /* The function will be short lived and removed after we inline all the + clones, but make it internal so we won't confuse ourself. */ DECL_EXTERNAL (first_clone->decl) = 0; TREE_PUBLIC (first_clone->decl) = 0; DECL_COMDAT (first_clone->decl) = 0; first_clone->ipa_transforms_to_apply.release (); /* When doing recursive inlining, the clone may become unnecessary. - This is possible i.e. in the case when the recursive function is proved to be - non-throwing and the recursion happens only in the EH landing pad. + This is possible i.e. in the case when the recursive function is proved to + be non-throwing and the recursion happens only in the EH landing pad. We cannot remove the clone until we are done with saving the body. Remove it now. */ if (!first_clone->callers) @@ -696,6 +696,14 @@ inline_transform (struct cgraph_node *node) if (cfun->after_inlining) return 0; + cgraph_node *next_clone; + for (cgraph_node *n = node->clones; n; n = next_clone) + { + next_clone = n->next_sibling_clone; + if (n->decl != node->decl) + n->materialize_clone (); + } + /* We might need the body of this function so that we can expand it inline somewhere else. */ if (preserve_function_body_p (node)) |