GCC with patches for OS216
Revision | 3fd18ee6041651747fc70aba4d7afd3fc8c48bc4 (tree) |
---|---|
Time | 2020-06-24 08:48:01 |
Author | Giuliano Belinassi <giuliano.belinassi@usp....> |
Commiter | Giuliano Belinassi |
Run ipa passes when split_outputs
Previously, a bug prevented the ipa passes to run when split_outputs
is provided. This commit fixes that by correctly setting the guard,
and updates how the flags in the partition boundary accordingly.
gcc/ChangeLog
2020-06-23 Giuliano Belinassi <giuliano.belinassi@usp.br>
* cgraphunit.c (ipa_passes): Run ipa passes also when
split_outputs.
* ipa-icf.c (gate): Don't run when split_outputs.
* lto-cgraph.c (lto_apply_partition_mask): Correctly set nodes in
the partition boundary.
@@ -1,3 +1,11 @@ | ||
1 | +2020-06-23 Giuliano Belinassi <giuliano.belinassi@usp.br> | |
2 | + | |
3 | + * cgraphunit.c (ipa_passes): Run ipa passes also when | |
4 | + split_outputs. | |
5 | + * ipa-icf.c (gate): Don't run when split_outputs. | |
6 | + * lto-cgraph.c (lto_apply_partition_mask): Correctly set nodes in | |
7 | + the partition boundary. | |
8 | + | |
1 | 9 | 2020-06-18 Giuliano Belinassi <giuliano.belinassi@usp.br> |
2 | 10 | |
3 | 11 | * toplev.c (lang_dependent_init): Move call to init_asm output to |
@@ -2769,7 +2769,7 @@ ipa_passes (void) | ||
2769 | 2769 | if (flag_generate_lto || flag_generate_offload) |
2770 | 2770 | targetm.asm_out.lto_end (); |
2771 | 2771 | |
2772 | - if (!flag_ltrans | |
2772 | + if ((!flag_ltrans || split_outputs) | |
2773 | 2773 | && ((in_lto_p && flag_incremental_link != INCREMENTAL_LINK_LTO) |
2774 | 2774 | || !flag_lto || flag_fat_lto_objects)) |
2775 | 2775 | execute_ipa_pass_list (passes->all_regular_ipa_passes); |
@@ -2345,7 +2345,7 @@ sem_item_optimizer::filter_removed_items (void) | ||
2345 | 2345 | { |
2346 | 2346 | cgraph_node *cnode = static_cast <sem_function *>(item)->get_node (); |
2347 | 2347 | |
2348 | - if (in_lto_p && (cnode->alias || cnode->body_removed)) | |
2348 | + if ((in_lto_p || split_outputs) && (cnode->alias || cnode->body_removed)) | |
2349 | 2349 | remove_item (item); |
2350 | 2350 | else |
2351 | 2351 | filtered.safe_push (item); |
@@ -963,7 +963,7 @@ public: | ||
963 | 963 | virtual bool gate (function *) |
964 | 964 | { |
965 | 965 | /* Only run on ltrans strage if split-args was provided. */ |
966 | - bool ret = !flag_ltrans || split_outputs; | |
966 | + bool ret = !flag_ltrans; | |
967 | 967 | return ret; |
968 | 968 | } |
969 | 969 | virtual unsigned int execute (function *) |
@@ -2106,10 +2106,32 @@ lto_apply_partition_mask (ltrans_partition partition) | ||
2106 | 2106 | cgraph_node *cnode = dyn_cast <cgraph_node *> (node); |
2107 | 2107 | if (cnode) |
2108 | 2108 | { |
2109 | - maybe_release_function_dominators (cnode); | |
2110 | - cnode->release_body (); | |
2111 | - if (!cnode->definition) | |
2112 | - cnode->body_removed = true; | |
2109 | + if (cnode->clone_of) | |
2110 | + cnode->remove_from_clone_tree (); | |
2111 | + | |
2112 | + if (cnode->has_gimple_body_p ()) | |
2113 | + { | |
2114 | + maybe_release_function_dominators (cnode); | |
2115 | + cnode->remove_callees (); | |
2116 | + cnode->remove_all_references (); | |
2117 | + cnode->release_body (); | |
2118 | + cnode->body_removed = true; | |
2119 | + cnode->analyzed = false; | |
2120 | + cnode->definition = false; | |
2121 | + cnode->cpp_implicit_alias = false; | |
2122 | + cnode->alias = false; | |
2123 | + cnode->transparent_alias = false; | |
2124 | + cnode->thunk.thunk_p = false; | |
2125 | + cnode->weakref = false; | |
2126 | + /* After early inlining we drop always_inline attributes on | |
2127 | + bodies of functions that are still referenced (have their | |
2128 | + address taken). */ | |
2129 | + DECL_ATTRIBUTES (cnode->decl) | |
2130 | + = remove_attribute ("always_inline", | |
2131 | + DECL_ATTRIBUTES (node->decl)); | |
2132 | + | |
2133 | + cnode->in_other_partition = true; | |
2134 | + } | |
2113 | 2135 | } |
2114 | 2136 | } |
2115 | 2137 | } |
@@ -2127,4 +2149,6 @@ lto_apply_partition_mask (ltrans_partition partition) | ||
2127 | 2149 | |
2128 | 2150 | node->remove (); |
2129 | 2151 | } |
2152 | + | |
2153 | + symtab->remove_unreachable_nodes (NULL); | |
2130 | 2154 | } |