public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Rafael Espindola" <espindola@google.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "Diego Novillo" <dnovillo@google.com>
Subject: [lto][patch] Remove nodes for extern inline function before writing to disk
Date: Thu, 09 Oct 2008 13:41:00 -0000	[thread overview]
Message-ID: <38a0d8450810090623j63452261mf64f64601c112efd@mail.gmail.com> (raw)

[-- 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.
 

             reply	other threads:[~2008-10-09 13:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09 13:41 Rafael Espindola [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38a0d8450810090623j63452261mf64f64601c112efd@mail.gmail.com \
    --to=espindola@google.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).