cgraphunit.c (symbol_table::process_new_functions): Update.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 23 May 2017 16:20:53 +0000 (18:20 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 23 May 2017 16:20:53 +0000 (16:20 +0000)
* cgraphunit.c (symbol_table::process_new_functions): Update.
* ipa-fnsummary.c (pass_data_inline_parameters): Remove.
(inline_generate_summary): Rename to ...
(ipa_fn_summary_generate): ... this one.
(inline_read_summary): Rename to ...
(ipa_fn_summary_read): ... this one.
(inline_write_summary): Rename to ...
(ipa_fn_summary_write): ... this one.
(inline_free_summary): Rename to ...
(ipa_free_fn_summary): ... this one.
(pass_data_local_fn_summary, pass_local_fn_summary,
make_pass_local_fn_summary, pass_data_ipa_free_fn_summary,
pass_ipa_free_fn_summary, make_pass_ipa_free_fn_summary,
pass_data_ipa_fn_summary, pass_ipa_fn_summary,
make_pass_ipa_fn_summary): New.
* ipa-fnsummary.h (inline_generate_summary, inline_read_summary,
inline_write_summary, inline_free_summary): Remove.
(ipa_free_fn_summary) : New.
* ipa-inline.c (ipa_inline): Update.
(pass_ipa_inline): Do not generate summaries.
* ipa.c (pass_data_ipa_free_fn_summary, pass_ipa_free_fn_summary):
Remove.
* passes.def: Replace pass_inline_parameters by pass_local_fn_summary
and add pass_ipa_fn_summary.
* tree-pass.h (make_pass_ipa_fn_summary, make_pass_local_fn_summary):
New.
(make_pass_inline_parameters): Remove.

* lto.c (do_whole_program_analysis): Replace inline_free_summary
by ipa_free_fn_summary.

* gcc.dg/ipa/ctor-empty-1.c: Update template.
* gcc.dg/ipa/inline-5.c: Likewise.
* gfortran.dg/pr48636.f90: Likewise.

From-SVN: r248375

14 files changed:
gcc/ChangeLog
gcc/cgraphunit.c
gcc/ipa-fnsummary.c
gcc/ipa-fnsummary.h
gcc/ipa-inline.c
gcc/ipa.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/passes.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
gcc/testsuite/gcc.dg/ipa/inline-5.c
gcc/testsuite/gfortran.dg/pr48636.f90
gcc/tree-pass.h

index b626515cfb740f0fefc197ebc708b33ba8f69e94..57849a84e233ce0a2ad9bbb3ae686c42d212ff58 100644 (file)
@@ -1,3 +1,33 @@
+2017-05-23  Jan Hubicka  <hubicka@ucw.cz>
+
+       * cgraphunit.c (symbol_table::process_new_functions): Update.
+       * ipa-fnsummary.c (pass_data_inline_parameters): Remove.
+       (inline_generate_summary): Rename to ...
+       (ipa_fn_summary_generate): ... this one.
+       (inline_read_summary): Rename to ...
+       (ipa_fn_summary_read): ... this one.
+       (inline_write_summary): Rename to ...
+       (ipa_fn_summary_write): ... this one.
+       (inline_free_summary): Rename to ...
+       (ipa_free_fn_summary): ... this one.
+       (pass_data_local_fn_summary, pass_local_fn_summary,
+       make_pass_local_fn_summary, pass_data_ipa_free_fn_summary,
+       pass_ipa_free_fn_summary, make_pass_ipa_free_fn_summary,
+       pass_data_ipa_fn_summary, pass_ipa_fn_summary,
+       make_pass_ipa_fn_summary): New.
+       * ipa-fnsummary.h (inline_generate_summary, inline_read_summary,
+       inline_write_summary, inline_free_summary): Remove.
+       (ipa_free_fn_summary) : New.
+       * ipa-inline.c (ipa_inline): Update.
+       (pass_ipa_inline): Do not generate summaries.
+       * ipa.c (pass_data_ipa_free_fn_summary, pass_ipa_free_fn_summary):
+       Remove.
+       * passes.def: Replace pass_inline_parameters by pass_local_fn_summary
+       and add pass_ipa_fn_summary.
+       * tree-pass.h (make_pass_ipa_fn_summary, make_pass_local_fn_summary):
+       New.
+       (make_pass_inline_parameters): Remove.
+
 2017-05-23  Thomas Schwinge  <thomas@codesourcery.com>
 
        * omp-low.c (struct omp_context): Remove "default_kind" member.
index 34f8aaba128ddd42dc7fc48fdc4d0f91e3b30376..7b4f47e6efb41e7c401e7347d86fffca6618c4e9 100644 (file)
@@ -339,7 +339,7 @@ symbol_table::process_new_functions (void)
                 and splitting.  This is redundant for functions added late.
                 Just throw away whatever it did.  */
              if (!summaried_computed)
-               inline_free_summary ();
+               ipa_free_fn_summary ();
            }
          else if (ipa_fn_summaries != NULL)
            compute_fn_summary (node, true);
index 0a5abb54780457c8f764d6487694ad21bdee757d..0e74fc3192735cd27056c4b6f57f15844f07a9ea 100644 (file)
@@ -2504,46 +2504,6 @@ compute_fn_summary_for_current (void)
   return 0;
 }
 
-namespace {
-
-const pass_data pass_data_inline_parameters =
-{
-  GIMPLE_PASS, /* type */
-  "inline_param", /* name */
-  OPTGROUP_INLINE, /* optinfo_flags */
-  TV_INLINE_PARAMETERS, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
-};
-
-class pass_inline_parameters : public gimple_opt_pass
-{
-public:
-  pass_inline_parameters (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_inline_parameters, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  opt_pass * clone () { return new pass_inline_parameters (m_ctxt); }
-  virtual unsigned int execute (function *)
-    {
-      return compute_fn_summary_for_current ();
-    }
-
-}; // class pass_inline_parameters
-
-} // anon namespace
-
-gimple_opt_pass *
-make_pass_inline_parameters (gcc::context *ctxt)
-{
-  return new pass_inline_parameters (ctxt);
-}
-
-
 /* Estimate benefit devirtualizing indirect edge IE, provided KNOWN_VALS,
    KNOWN_CONTEXTS and KNOWN_AGGS.  */
 
@@ -3207,8 +3167,8 @@ ipa_fn_summary_t::insert (struct cgraph_node *node, ipa_fn_summary *)
 
 /* Note function body size.  */
 
-void
-inline_generate_summary (void)
+static void
+ipa_fn_summary_generate (void)
 {
   struct cgraph_node *node;
 
@@ -3226,7 +3186,7 @@ inline_generate_summary (void)
   ipa_fn_summaries->enable_insertion_hook ();
 
   ipa_register_cgraph_hooks ();
-  inline_free_summary ();
+  ipa_free_fn_summary ();
 
   FOR_EACH_DEFINED_FUNCTION (node)
     if (!node->alias)
@@ -3358,8 +3318,8 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
    and inliner, so when ipa-cp is active, we don't need to write them
    twice.  */
 
-void
-inline_read_summary (void)
+static void
+ipa_fn_summary_read (void)
 {
   struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data ();
   struct lto_file_decl_data *file_data;
@@ -3419,8 +3379,8 @@ write_ipa_call_summary (struct output_block *ob, struct cgraph_edge *e)
    Jump functions are shared among ipa-cp and inliner, so when ipa-cp is
    active, we don't need to write them twice.  */
 
-void
-inline_write_summary (void)
+static void
+ipa_fn_summary_write (void)
 {
   struct output_block *ob = create_output_block (LTO_section_ipa_fn_summary);
   lto_symtab_encoder_t encoder = ob->decl_state->symtab_node_encoder;
@@ -3510,7 +3470,7 @@ inline_write_summary (void)
 /* Release inline summary.  */
 
 void
-inline_free_summary (void)
+ipa_free_fn_summary (void)
 {
   struct cgraph_node *node;
   if (!ipa_call_summaries)
@@ -3525,3 +3485,131 @@ inline_free_summary (void)
   ipa_call_summaries = NULL;
   edge_predicate_pool.release ();
 }
+
+namespace {
+
+const pass_data pass_data_local_fn_summary =
+{
+  GIMPLE_PASS, /* type */
+  "local-fnsummary", /* name */
+  OPTGROUP_INLINE, /* optinfo_flags */
+  TV_INLINE_PARAMETERS, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
+};
+
+class pass_local_fn_summary : public gimple_opt_pass
+{
+public:
+  pass_local_fn_summary (gcc::context *ctxt)
+    : gimple_opt_pass (pass_data_local_fn_summary, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  opt_pass * clone () { return new pass_local_fn_summary (m_ctxt); }
+  virtual unsigned int execute (function *)
+    {
+      return compute_fn_summary_for_current ();
+    }
+
+}; // class pass_local_fn_summary
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_local_fn_summary (gcc::context *ctxt)
+{
+  return new pass_local_fn_summary (ctxt);
+}
+
+
+/* Free inline summary.  */
+
+namespace {
+
+const pass_data pass_data_ipa_free_fn_summary =
+{
+  SIMPLE_IPA_PASS, /* type */
+  "free-fnsummary", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  /* Early optimizations may make function unreachable.  We can not
+     remove unreachable functions as part of the ealry opts pass because
+     TODOs are run before subpasses.  Do it here.  */
+  ( TODO_remove_functions | TODO_dump_symtab ), /* todo_flags_finish */
+};
+
+class pass_ipa_free_fn_summary : public simple_ipa_opt_pass
+{
+public:
+  pass_ipa_free_fn_summary (gcc::context *ctxt)
+    : simple_ipa_opt_pass (pass_data_ipa_free_fn_summary, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *)
+    {
+      ipa_free_fn_summary ();
+      return 0;
+    }
+
+}; // class pass_ipa_free_fn_summary
+
+} // anon namespace
+
+simple_ipa_opt_pass *
+make_pass_ipa_free_fn_summary (gcc::context *ctxt)
+{
+  return new pass_ipa_free_fn_summary (ctxt);
+}
+
+namespace {
+
+const pass_data pass_data_ipa_fn_summary =
+{
+  IPA_PASS, /* type */
+  "fnsummary", /* name */
+  OPTGROUP_INLINE, /* optinfo_flags */
+  TV_IPA_INLINING, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  ( TODO_dump_symtab ), /* todo_flags_finish */
+};
+
+class pass_ipa_fn_summary : public ipa_opt_pass_d
+{
+public:
+  pass_ipa_fn_summary (gcc::context *ctxt)
+    : ipa_opt_pass_d (pass_data_ipa_fn_summary, ctxt,
+                     ipa_fn_summary_generate, /* generate_summary */
+                     ipa_fn_summary_write, /* write_summary */
+                     ipa_fn_summary_read, /* read_summary */
+                     NULL, /* write_optimization_summary */
+                     NULL, /* read_optimization_summary */
+                     NULL, /* stmt_fixup */
+                     0, /* function_transform_todo_flags_start */
+                     NULL, /* function_transform */
+                     NULL) /* variable_transform */
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *) { return 0; }
+
+}; // class pass_ipa_fn_summary
+
+} // anon namespace
+
+ipa_opt_pass_d *
+make_pass_ipa_fn_summary (gcc::context *ctxt)
+{
+  return new pass_ipa_fn_summary (ctxt);
+}
index 60f7e75ff44638b9d7ace37fa518b777817c34ef..f50d6806e61a92add83e10e35f006be18f8d68fe 100644 (file)
@@ -231,10 +231,7 @@ void ipa_debug_fn_summary (struct cgraph_node *);
 void ipa_dump_fn_summaries (FILE *f);
 void ipa_dump_fn_summary (FILE *f, struct cgraph_node *node);
 void ipa_dump_hints (FILE *f, ipa_hints);
-void inline_generate_summary (void);
-void inline_read_summary (void);
-void inline_write_summary (void);
-void inline_free_summary (void);
+void ipa_free_fn_summary (void);
 void inline_analyze_function (struct cgraph_node *node);
 void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
                                        vec<tree>,
index 674f8acb24806e90be363588ecf3965e569e8126..0ebe1477f6cbd28a6bd7c59a30769af47817113d 100644 (file)
@@ -2502,7 +2502,7 @@ ipa_inline (void)
     ipa_dump_fn_summaries (dump_file);
   /* In WPA we use inline summaries for partitioning process.  */
   if (!flag_wpa)
-    inline_free_summary ();
+    ipa_free_fn_summary ();
   return remove_functions ? TODO_remove_functions : 0;
 }
 
@@ -2808,9 +2808,9 @@ class pass_ipa_inline : public ipa_opt_pass_d
 public:
   pass_ipa_inline (gcc::context *ctxt)
     : ipa_opt_pass_d (pass_data_ipa_inline, ctxt,
-                     inline_generate_summary, /* generate_summary */
-                     inline_write_summary, /* write_summary */
-                     inline_read_summary, /* read_summary */
+                     NULL, /* generate_summary */
+                     NULL, /* write_summary */
+                     NULL, /* read_summary */
                      NULL, /* write_optimization_summary */
                      NULL, /* read_optimization_summary */
                      NULL, /* stmt_fixup */
index e5b6eded690c06f30233b1312525d880cdeda116..3dc8e41a7ff759893bf78e2886b12ed875076328 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -843,50 +843,6 @@ ipa_discover_readonly_nonaddressable_vars (void)
   return remove_p;
 }
 
-/* Free inline summary.  */
-
-namespace {
-
-const pass_data pass_data_ipa_free_fn_summary =
-{
-  SIMPLE_IPA_PASS, /* type */
-  "free-inline-summary", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */
-  0, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  /* Early optimizations may make function unreachable.  We can not
-     remove unreachable functions as part of the ealry opts pass because
-     TODOs are run before subpasses.  Do it here.  */
-  ( TODO_remove_functions | TODO_dump_symtab ), /* todo_flags_finish */
-};
-
-class pass_ipa_free_fn_summary : public simple_ipa_opt_pass
-{
-public:
-  pass_ipa_free_fn_summary (gcc::context *ctxt)
-    : simple_ipa_opt_pass (pass_data_ipa_free_fn_summary, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual unsigned int execute (function *)
-    {
-      inline_free_summary ();
-      return 0;
-    }
-
-}; // class pass_ipa_free_fn_summary
-
-} // anon namespace
-
-simple_ipa_opt_pass *
-make_pass_ipa_free_fn_summary (gcc::context *ctxt)
-{
-  return new pass_ipa_free_fn_summary (ctxt);
-}
-
 /* Generate and emit a static constructor or destructor.  WHICH must
    be one of 'I' (for a constructor), 'D' (for a destructor), 'P'
    (for chp static vars constructor) or 'B' (for chkp static bounds
index 06f4d2bd7fa2ccfb694eebf16d7d8fe82df5c814..e63f2037191a049d0f24b30f4d2f32a7935ed4a7 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-23  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lto.c (do_whole_program_analysis): Replace inline_free_summary
+       by ipa_free_fn_summary.
+
 2017-05-23  Martin Liska  <mliska@suse.cz>
 
        * lto-symtab.c (lto_cgraph_replace_node): Use
index 6671d8a9622fca805c7d152fc0f566761617cb64..44ddf4195704027494b58cb51e627241c5954c11 100644 (file)
@@ -3129,7 +3129,7 @@ do_whole_program_analysis (void)
 
   /* Inline summaries are needed for balanced partitioning.  Free them now so
      the memory can be used for streamer caches.  */
-  inline_free_summary ();
+  ipa_free_fn_summary ();
 
   /* AUX pointers are used by partitioning code to bookkeep number of
      partitions symbol is in.  This is no longer needed.  */
index 2b460324b242265bf70281bd1c8efa65b2fe4f35..10a18bf075147a2b85bd2aa44dd8c0eaea35f6d3 100644 (file)
@@ -75,7 +75,7 @@ along with GCC; see the file COPYING3.  If not see
   PUSH_INSERT_PASSES_WITHIN (pass_local_optimization_passes)
       NEXT_PASS (pass_fixup_cfg);
       NEXT_PASS (pass_rebuild_cgraph_edges);
-      NEXT_PASS (pass_inline_parameters);
+      NEXT_PASS (pass_local_fn_summary);
       NEXT_PASS (pass_early_inline);
       NEXT_PASS (pass_all_early_optimizations);
       PUSH_INSERT_PASSES_WITHIN (pass_all_early_optimizations)
@@ -110,7 +110,7 @@ along with GCC; see the file COPYING3.  If not see
       POP_INSERT_PASSES ()
       NEXT_PASS (pass_release_ssa_names);
       NEXT_PASS (pass_rebuild_cgraph_edges);
-      NEXT_PASS (pass_inline_parameters);
+      NEXT_PASS (pass_local_fn_summary);
   POP_INSERT_PASSES ()
 
   NEXT_PASS (pass_ipa_oacc);
@@ -157,6 +157,7 @@ along with GCC; see the file COPYING3.  If not see
   NEXT_PASS (pass_ipa_cp);
   NEXT_PASS (pass_ipa_cdtor_merge);
   NEXT_PASS (pass_ipa_hsa);
+  NEXT_PASS (pass_ipa_fn_summary);
   NEXT_PASS (pass_ipa_inline);
   NEXT_PASS (pass_ipa_pure_const);
   NEXT_PASS (pass_ipa_reference);
index 9877c76a0e500da775cdc8dbef9e7753d8b9e600..e5d4fce0dbec662bd1965daf1e4f40594f58fe38 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-23  Jan Hubicka  <hubicka@ucw.cz>
+
+       * gcc.dg/ipa/ctor-empty-1.c: Update template.
+       * gcc.dg/ipa/inline-5.c: Likewise.
+       * gfortran.dg/pr48636.f90: Likewise.
+
 2017-05-23  Nathan Sidwell  <nathan@acm.org>
 
        * g++.dg/parse/ctor9.C: Adjust expected error.
index e9e8b12a5ea15ebec6e41fa26010b0e2f875e302..0807d494c034e5cdd5ff0e8fe2d5e344a99c6e20 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O3 -c -fdump-ipa-free-inline-summary"  } */
+/* { dg-options "-O3 -c -fdump-ipa-free-fnsummary"  } */
 static __attribute__((constructor))
 void empty_constructor()
 {
 }
-/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor"  "free-inline-summary"  } } */
+/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor"  "free-fnsummary"  } } */
index 06156ce49079edd49b6b07bb64ceac5431436389..559e258955e43b6100823ce113f8c2f0ca0e7180 100644 (file)
@@ -1,6 +1,6 @@
 /* Check statements that are eliminated by inlining.  */
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-ipa-inline-details -fno-early-inlining -fno-partial-inlining -fno-ipa-cp"  } */
+/* { dg-options "-O2 -fdump-ipa-fnsummary-details -fno-early-inlining -fno-partial-inlining -fno-ipa-cp"  } */
 
 struct a {int a,b,c,d,e;};
 void t(int);
@@ -34,5 +34,5 @@ accessreference (struct a *a)
     /* Will be eliminated by inlining */
 }
 
-/* { dg-final { scan-ipa-dump-times "Will be eliminated" 4 "inline" { xfail { { hppa*-*-* } && { ! lp64 } } } } } */
-/* { dg-final { scan-ipa-dump-times "50. will be eliminated" 1 "inline"  } } */
+/* { dg-final { scan-ipa-dump-times "Will be eliminated" 4 "fnsummary" { xfail { { hppa*-*-* } && { ! lp64 } } } } } */
+/* { dg-final { scan-ipa-dump-times "50. will be eliminated" 1 "fnsummary"  } } */
index 926d8f3fc5a525bdde33b2ef7b7b2a8bb6eab774..8b16680c5b6baeeb292f224aa4833f5ad47df7be 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-! { dg-options "-O3 -fdump-ipa-inline-details -fno-ipa-cp" }
+! { dg-options "-O3 -fdump-ipa-inline-details -fdump-ipa-fnsummary-details -fno-ipa-cp" }
 
 module foo
   implicit none
@@ -34,5 +34,5 @@ program main
 end program main
 
 ! { dg-final { scan-ipa-dump "bar\[^\\n\]*inline copy in MAIN" "inline" } }
-! { dg-final { scan-ipa-dump-times "phi predicate:" 3 "inline" } }
-! { dg-final { scan-ipa-dump "inline hints: loop_iterations" "inline" } }
+! { dg-final { scan-ipa-dump-times "phi predicate:" 3 "fnsummary" } }
+! { dg-final { scan-ipa-dump "inline hints: loop_iterations" "fnsummary" } }
index 92a3426014c9b7f0ae98eb80b10148f153149971..cfa4b01f81ab46b6a3f006cad2ffaf47cc7f49b0 100644 (file)
@@ -494,6 +494,7 @@ extern ipa_opt_pass_d *make_pass_ipa_whole_program_visibility (gcc::context
                                                               *ctxt);
 extern simple_ipa_opt_pass *make_pass_ipa_increase_alignment (gcc::context
                                                              *ctxt);
+extern ipa_opt_pass_d *make_pass_ipa_fn_summary (gcc::context *ctxt);
 extern ipa_opt_pass_d *make_pass_ipa_inline (gcc::context *ctxt);
 extern simple_ipa_opt_pass *make_pass_ipa_free_lang_data (gcc::context *ctxt);
 extern simple_ipa_opt_pass *make_pass_ipa_free_fn_summary (gcc::context *ctxt);
@@ -617,7 +618,7 @@ extern rtl_opt_pass *make_pass_final (gcc::context *ctxt);
 extern rtl_opt_pass *make_pass_rtl_seqabstr (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_release_ssa_names (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_early_inline (gcc::context *ctxt);
-extern gimple_opt_pass *make_pass_inline_parameters (gcc::context *ctxt);
+extern gimple_opt_pass *make_pass_local_fn_summary (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_update_address_taken (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_lower_vaarg (gcc::context *ctxt);