cgraphunit.c (ipa_passes): Remove unrechable nodes.
authorJan Hubicka <jh@suse.cz>
Sun, 2 Oct 2011 14:30:50 +0000 (16:30 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 2 Oct 2011 14:30:50 +0000 (14:30 +0000)
* 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

gcc/ChangeLog
gcc/cgraphunit.c
gcc/ipa.c
gcc/lto-streamer-out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
gcc/tree-sra.c

index b8eef47ef207c1ee805cf663570c22c4ed141645..05539e6355c33f2b99a17bb5fddee71a7e349140 100644 (file)
@@ -1,3 +1,11 @@
+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.
index 999b238233377c5308904050dc716e951c08fa09..5964570d882d6023e7499102c4323fe1e3aa2d94 100644 (file)
@@ -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)
index a8c4a358e04a48ea01ef040f0aa3f38d97910419..dfd8eef99ca362c3bab3f2fe0ed7608ea2732a67 100644 (file)
--- 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);
index 317138b824d380873b7fcf7ff68e1a748f3f3d96..d107b916e56d5b25e4846bbafecb0021fba9cfd6 100644 (file)
@@ -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;
index 6bee26741d5881e3fc423cc63a00f3d24f771ebe..37a71e5e4d86d1ae882778b06a682532e48c4fc5 100644 (file)
@@ -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.
index 9cd2b09fb0da6e38668efa585329ec50b0fcaa40..bb8e7aff25d87e2b11af4bdda64cb74bf6e9c58b 100644 (file)
@@ -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" } } */
index 39d0278cf704a8ba152b65dfff3dc35b122bcecd..c83f480643c0be818ef3ca0f08624d5e5877d995 100644 (file)
@@ -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;