aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-10-02 16:30:50 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-10-02 14:30:50 +0000
commit467a8db025e7513bca07688dc3eaf515bed0eb87 (patch)
treef40e1b4f38e5db0794b1f03ee8f8d26958cf4b8b /gcc
parent78e5ce9f1eb789154f083296ae85a7582bc36a97 (diff)
downloadgcc-467a8db025e7513bca07688dc3eaf515bed0eb87.zip
gcc-467a8db025e7513bca07688dc3eaf515bed0eb87.tar.gz
gcc-467a8db025e7513bca07688dc3eaf515bed0eb87.tar.bz2
cgraphunit.c (ipa_passes): Remove unrechable nodes.
* cgraphunit.c (ipa_passes): Remove unrechable nodes. * lto-streamer-out.c (produce_symtab): Skip unused extern declarations. * ipa.c (cgraph_remove_unreachable_nodes): Do not assume that external functions are reachable when address is taken. * ipa-inline-analysis.c (reset_inline_edge_summary): New * gcc.dg/ipa/ctor-empty-1.c: Update dump file. From-SVN: r179429
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cgraphunit.c6
-rw-r--r--gcc/ipa.c7
-rw-r--r--gcc/lto-streamer-out.c9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c6
-rw-r--r--gcc/tree-sra.c1
7 files changed, 32 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b8eef47..05539e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2011-10-02 Jan Hubicka <jh@suse.cz>
+ * cgraphunit.c (ipa_passes): Remove unrechable nodes.
+ * lto-streamer-out.c (produce_symtab): Skip unused extern declarations.
+ * ipa.c (cgraph_remove_unreachable_nodes): Do not assume that external
+ functions are reachable when address is taken.
+ * tree-sra.c (modify_function): Free dominance info.
+
+2011-10-02 Jan Hubicka <jh@suse.cz>
+
* ipa-inline-analysis.c (inline_summary_alloc): Bounds check.
* ipa-inline-analysis.c (reset_inline_edge_summary): New function.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 999b238..5964570 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2011,6 +2011,12 @@ ipa_passes (void)
return;
}
+ /* We never run removal of unreachable nodes after early passes. This is
+ because TODO is run before the subpasses. It is important to remove
+ the unreachable functions to save works at IPA level and to get LTO
+ symbol tables right. */
+ cgraph_remove_unreachable_nodes (true, cgraph_dump_file);
+
/* If pass_all_early_optimizations was not scheduled, the state of
the cgraph will not be properly updated. Update it now. */
if (cgraph_state < CGRAPH_STATE_IPA_SSA)
diff --git a/gcc/ipa.c b/gcc/ipa.c
index a8c4a35..dfd8eef 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -196,12 +196,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
/* Keep around virtual functions for possible devirtualization. */
|| (before_inlining_p
&& DECL_VIRTUAL_P (node->decl)
- && (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl)))
- /* Also external functions with address taken are better to stay
- for indirect inlining. */
- || (before_inlining_p
- && DECL_EXTERNAL (node->decl)
- && node->address_taken)))
+ && (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl)))))
{
gcc_assert (!node->global.inlined_to);
enqueue_cgraph_node (node, &first);
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 317138b..d107b91 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1407,6 +1407,15 @@ produce_symtab (struct output_block *ob,
node = lto_cgraph_encoder_deref (encoder, i);
if (!DECL_EXTERNAL (node->decl))
continue;
+ /* We keep around unused extern inlines in order to be able to inline
+ them indirectly or via vtables. Do not output them to symbol
+ table: they end up being undefined and just consume space. */
+ if (!node->address_taken && !node->callers)
+ {
+ gcc_assert (node->analyzed);
+ gcc_assert (DECL_DECLARED_INLINE_P (node->decl));
+ continue;
+ }
if (DECL_COMDAT (node->decl)
&& cgraph_comdat_can_be_unshared_p (node))
continue;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6bee267..37a71e5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-02 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/ipa/ctor-empty-1.c: Update dump file.
+
2011-10-01 David S. Miller <davem@davemloft.net>
* gcc.target/sparc/cmask.c: New test.
diff --git a/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c b/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
index 9cd2b09..bb8e7af 100644
--- a/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
@@ -1,8 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -c -fdump-ipa-whole-program" } */
+/* { dg-options "-O3 -c -fdump-ipa-cgraph" } */
static __attribute__((constructor))
void empty_constructor()
{
}
-/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "whole-program" } } */
-/* { dg-final { cleanup-ipa-dump "whole-program" } } */
+/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "cgraph" } } */
+/* { dg-final { cleanup-ipa-dump "cgraph" } } */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 39d0278..c83f480 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4622,6 +4622,7 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node (node);
rebuild_cgraph_edges ();
+ free_dominance_info (CDI_DOMINATORS);
pop_cfun ();
current_function_decl = NULL_TREE;