public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto][patch] Remove nodes for extern inline function before writing to disk
@ 2008-10-09 13:41 Rafael Espindola
  2008-10-09 13:53 ` Diego Novillo
  0 siblings, 1 reply; 12+ messages in thread
From: Rafael Espindola @ 2008-10-09 13:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

gcc normally removes the extern inline bodies after IPA. The problem
for LTO is that streaming is part of IPA.

This patch adds another pass so that we remove the bodies before streaming.

2008-10-08 Rafael Espindola  <espindola@google.com>

	* lto-cgraph.c (output_edge): Assert that the caller is not external.
	* passes.c (init_optimization_passes): Register pass_ipa_free_lang_specifics2.
	* tree-pass.h (pass_ipa_free_lang_specifics2): New.
	* tree.c (free_lang_specifics2): New.
	(pass_ipa_free_lang_specifics2): New.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: clean2.patch --]
[-- Type: text/x-diff; name=clean2.patch, Size: 2511 bytes --]

diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 12fad49..5ebdd50 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -167,6 +167,8 @@ output_edge (struct lto_simple_output_block *ob,
   intptr_t ref;
   unsigned HOST_WIDEST_INT flags = 0;
 
+  gcc_assert (!DECL_EXTERNAL (edge->caller->decl));
+
   lto_output_uleb128_stream (ob->main_stream, LTO_cgraph_edge);
   LTO_DEBUG_INDENT (LTO_cgraph_edge);
 
diff --git a/gcc/passes.c b/gcc/passes.c
index a39c7ab..7a9e0aa 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -572,6 +572,7 @@ init_optimization_passes (void)
     }
   NEXT_PASS (pass_ipa_increase_alignment);
   NEXT_PASS (pass_ipa_matrix_reorg);
+  NEXT_PASS (pass_ipa_free_lang_specifics2);
   NEXT_PASS (pass_ipa_cp);
   /* All regular IPA_PASSes need to be clumped together.  */
   NEXT_PASS (pass_ipa_lto_gimple_out);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index b574b65..13e31c5 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -392,6 +392,7 @@ extern struct gimple_opt_pass pass_reset_cc_flags;
 
 /* IPA Passes */
 extern struct simple_ipa_opt_pass pass_ipa_free_lang_specifics;
+extern struct simple_ipa_opt_pass pass_ipa_free_lang_specifics2;
 extern struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility;
 extern struct simple_ipa_opt_pass pass_ipa_early_inline;
 
diff --git a/gcc/tree.c b/gcc/tree.c
index 4be455a..7a81d1b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4103,6 +4103,13 @@ free_lang_specifics (void)
   return 0;
 }
 
+static unsigned
+free_lang_specifics2 (void)
+{
+  /* This pass remove bodies of extern inline functions we never inlined. */
+  cgraph_remove_unreachable_nodes (false, dump_file);
+  return 0;
+}
 
 /* Gate function for free_lang_specifics.  FIXME lto.  This should be
    unconditional and not depend on whether we're producing LTO
@@ -4135,6 +4142,25 @@ struct simple_ipa_opt_pass pass_ipa_free_lang_specifics =
  }
 };
 
+struct simple_ipa_opt_pass pass_ipa_free_lang_specifics2 =
+{
+ {
+  SIMPLE_IPA_PASS,
+  NULL,					/* name */
+  gate_free_lang_specifics,		/* gate */
+  free_lang_specifics2,			/* execute */
+  NULL,					/* sub */
+  NULL,					/* next */
+  0,					/* static_pass_number */
+  0,					/* tv_id */
+  0,	                                /* properties_required */
+  0,					/* properties_provided */
+  0,					/* properties_destroyed */
+  0,					/* todo_flags_start */
+  0					/* todo_flags_finish */
+ }
+};
+
 /* Return nonzero if IDENT is a valid name for attribute ATTR,
    or zero if not.
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-10-09 15:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-09 13:41 [lto][patch] Remove nodes for extern inline function before writing to disk Rafael Espindola
2008-10-09 13:53 ` Diego Novillo
2008-10-09 14:08   ` Rafael Espindola
2008-10-09 14:18     ` Diego Novillo
2008-10-09 14:18       ` Rafael Espindola
2008-10-09 14:30         ` Diego Novillo
2008-10-09 14:37           ` Rafael Espindola
2008-10-09 14:50             ` Diego Novillo
2008-10-09 15:55               ` Rafael Espindola
2008-10-09 16:20                 ` Diego Novillo
2008-10-09 17:30                   ` Rafael Espindola
2008-10-09 14:31         ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).