aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-06-23 20:48:01 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-06-23 20:48:01 -0300
commit3fd18ee6041651747fc70aba4d7afd3fc8c48bc4 (patch)
treef997b37b5d62c7376e323c232447d8910f118cf4
parent35bfd2e0d64af8962593a77a9b382d45866cebf9 (diff)
downloadgcc-3fd18ee6041651747fc70aba4d7afd3fc8c48bc4.zip
gcc-3fd18ee6041651747fc70aba4d7afd3fc8c48bc4.tar.gz
gcc-3fd18ee6041651747fc70aba4d7afd3fc8c48bc4.tar.bz2
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.
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cgraphunit.c2
-rw-r--r--gcc/ipa-icf.c2
-rw-r--r--gcc/ipa-visibility.c2
-rw-r--r--gcc/lto-cgraph.c32
5 files changed, 39 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c50fe1c..b999b1f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2020-06-18 Giuliano Belinassi <giuliano.belinassi@usp.br>
* toplev.c (lang_dependent_init): Move call to init_asm output to
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index f479c7a..4665fda 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2769,7 +2769,7 @@ ipa_passes (void)
if (flag_generate_lto || flag_generate_offload)
targetm.asm_out.lto_end ();
- if (!flag_ltrans
+ if ((!flag_ltrans || split_outputs)
&& ((in_lto_p && flag_incremental_link != INCREMENTAL_LINK_LTO)
|| !flag_lto || flag_fat_lto_objects))
execute_ipa_pass_list (passes->all_regular_ipa_passes);
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 069de9d..3befe4e 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -2345,7 +2345,7 @@ sem_item_optimizer::filter_removed_items (void)
{
cgraph_node *cnode = static_cast <sem_function *>(item)->get_node ();
- if (in_lto_p && (cnode->alias || cnode->body_removed))
+ if ((in_lto_p || split_outputs) && (cnode->alias || cnode->body_removed))
remove_item (item);
else
filtered.safe_push (item);
diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c
index 1459e5d..087775d 100644
--- a/gcc/ipa-visibility.c
+++ b/gcc/ipa-visibility.c
@@ -963,7 +963,7 @@ public:
virtual bool gate (function *)
{
/* Only run on ltrans strage if split-args was provided. */
- bool ret = !flag_ltrans || split_outputs;
+ bool ret = !flag_ltrans;
return ret;
}
virtual unsigned int execute (function *)
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 41a2399..acaef4a 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -2106,10 +2106,32 @@ lto_apply_partition_mask (ltrans_partition partition)
cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (cnode)
{
- maybe_release_function_dominators (cnode);
- cnode->release_body ();
- if (!cnode->definition)
- cnode->body_removed = true;
+ if (cnode->clone_of)
+ cnode->remove_from_clone_tree ();
+
+ if (cnode->has_gimple_body_p ())
+ {
+ maybe_release_function_dominators (cnode);
+ cnode->remove_callees ();
+ cnode->remove_all_references ();
+ cnode->release_body ();
+ cnode->body_removed = true;
+ cnode->analyzed = false;
+ cnode->definition = false;
+ cnode->cpp_implicit_alias = false;
+ cnode->alias = false;
+ cnode->transparent_alias = false;
+ cnode->thunk.thunk_p = false;
+ cnode->weakref = false;
+ /* After early inlining we drop always_inline attributes on
+ bodies of functions that are still referenced (have their
+ address taken). */
+ DECL_ATTRIBUTES (cnode->decl)
+ = remove_attribute ("always_inline",
+ DECL_ATTRIBUTES (node->decl));
+
+ cnode->in_other_partition = true;
+ }
}
}
}
@@ -2127,4 +2149,6 @@ lto_apply_partition_mask (ltrans_partition partition)
node->remove ();
}
+
+ symtab->remove_unreachable_nodes (NULL);
}