[gcc/devel/autopar_devel] Run ipa passes when split_outputs

Giuliano Belinassi giulianob@gcc.gnu.org
Tue Jun 23 23:53:29 GMT 2020


https://gcc.gnu.org/g:3fd18ee6041651747fc70aba4d7afd3fc8c48bc4

commit 3fd18ee6041651747fc70aba4d7afd3fc8c48bc4
Author: Giuliano Belinassi <giuliano.belinassi@usp.br>
Date:   Tue Jun 23 20:48:01 2020 -0300

    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.

Diff:
---
 gcc/ChangeLog        |  8 ++++++++
 gcc/cgraphunit.c     |  2 +-
 gcc/ipa-icf.c        |  2 +-
 gcc/ipa-visibility.c |  2 +-
 gcc/lto-cgraph.c     | 32 ++++++++++++++++++++++++++++----
 5 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c50fe1c266f..b999b1feedf 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 f479c7af0dc..4665fda1116 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 069de9d82fb..3befe4ea045 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 1459e5ddbfe..087775d0ab4 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 41a2399196f..acaef4af708 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);
 }


More information about the Gcc-cvs mailing list