Use summaries->get where possible. Small refactoring of multiple calls.
authorMartin Liska <mliska@suse.cz>
Fri, 8 Jun 2018 12:14:02 +0000 (14:14 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 8 Jun 2018 12:14:02 +0000 (12:14 +0000)
2018-06-08  Martin Liska  <mliska@suse.cz>

* ipa-fnsummary.c (dump_ipa_call_summary): Use ::get method.
(analyze_function_body): Extract multiple calls of get_create.
* ipa-inline-analysis.c (simple_edge_hints): Likewise.
* ipa-inline.c (recursive_inlining): Use ::get method.
* ipa-inline.h (estimate_edge_growth): Likewise.

From-SVN: r261311

gcc/ChangeLog
gcc/ipa-fnsummary.c
gcc/ipa-inline-analysis.c
gcc/ipa-inline.c
gcc/ipa-inline.h

index c306be8e60bc7d49bcd855d7bedf0622d5f7eea1..d44a78d06b684f599b38ed640ea13198e2d4611d 100644 (file)
@@ -1,3 +1,11 @@
+2018-06-08  Martin Liska  <mliska@suse.cz>
+
+       * ipa-fnsummary.c (dump_ipa_call_summary): Use ::get method.
+       (analyze_function_body): Extract multiple calls of get_create.
+       * ipa-inline-analysis.c (simple_edge_hints): Likewise.
+       * ipa-inline.c (recursive_inlining): Use ::get method.
+       * ipa-inline.h (estimate_edge_growth): Likewise.
+
 2018-06-08  Martin Liska  <mliska@suse.cz>
 
        * hsa-common.h (enum hsa_function_kind): Rename HSA_NONE to
index 8a6c5d0b5d8c2168c85319312d4724479b941394..e40b537bf617f9355e8dfb9c3970ddd7370959ec 100644 (file)
@@ -850,7 +850,7 @@ dump_ipa_call_summary (FILE *f, int indent, struct cgraph_node *node,
          }
       if (!edge->inline_failed)
        {
-         ipa_fn_summary *s = ipa_fn_summaries->get_create (callee);
+         ipa_fn_summary *s = ipa_fn_summaries->get (callee);
          fprintf (f, "%*sStack frame offset %i, callee self size %i,"
                   " callee size %i\n",
                   indent + 2, "",
@@ -2363,10 +2363,9 @@ analyze_function_body (struct cgraph_node *node, bool early)
            }
          free (body);
        }
-      set_hint_predicate (&ipa_fn_summaries->get_create (node)->loop_iterations,
-                         loop_iterations);
-      set_hint_predicate (&ipa_fn_summaries->get_create (node)->loop_stride,
-                         loop_stride);
+      ipa_fn_summary *s = ipa_fn_summaries->get_create (node);
+      set_hint_predicate (&s->loop_iterations, loop_iterations);
+      set_hint_predicate (&s->loop_stride, loop_stride);
       scev_finalize ();
     }
   FOR_ALL_BB_FN (bb, my_function)
@@ -2384,8 +2383,9 @@ analyze_function_body (struct cgraph_node *node, bool early)
          e->aux = NULL;
        }
     }
-  ipa_fn_summaries->get_create (node)->time = time;
-  ipa_fn_summaries->get_create (node)->self_size = size;
+  ipa_fn_summary *s = ipa_fn_summaries->get_create (node);
+  s->time = time;
+  s->self_size = size;
   nonconstant_names.release ();
   ipa_release_body_info (&fbi);
   if (opt_for_fn (node->decl, optimize))
index c4f904730e6f881f9f16aed4f4403744a118d7b2..2e30a6d15baab06126f545e31dfc32aa1560c30a 100644 (file)
@@ -126,7 +126,7 @@ simple_edge_hints (struct cgraph_edge *edge)
                            ? edge->caller->global.inlined_to : edge->caller);
   struct cgraph_node *callee = edge->callee->ultimate_alias_target ();
   if (ipa_fn_summaries->get_create (to)->scc_no
-      && ipa_fn_summaries->get_create (to)->scc_no
+      && ipa_fn_summaries->get (to)->scc_no
         == ipa_fn_summaries->get_create (callee)->scc_no
       && !edge->recursive_p ())
     hints |= INLINE_HINT_same_scc;
index ffde9b9c472e7bc359df1e5cd90e9a676a9bca50..51044b7b612826421f77cfb3872e180681d75dff 100644 (file)
@@ -1559,10 +1559,10 @@ recursive_inlining (struct cgraph_edge *edge,
     fprintf (dump_file,
             "\n   Inlined %i times, "
             "body grown from size %i to %i, time %f to %f\n", n,
-            ipa_fn_summaries->get_create (master_clone)->size,
-            ipa_fn_summaries->get_create (node)->size,
-            ipa_fn_summaries->get_create (master_clone)->time.to_double (),
-            ipa_fn_summaries->get_create (node)->time.to_double ());
+            ipa_fn_summaries->get (master_clone)->size,
+            ipa_fn_summaries->get (node)->size,
+            ipa_fn_summaries->get (master_clone)->time.to_double (),
+            ipa_fn_summaries->get (node)->time.to_double ());
 
   /* Remove master clone we used for inlining.  We rely that clones inlined
      into master clone gets queued just before master clone so we don't
index e8ae206d7b7e1dfa29e99f71bf03e2bbf4e8ec7c..06bd38e551e0faccdaa58a929261e5016791f172 100644 (file)
@@ -81,10 +81,9 @@ estimate_edge_size (struct cgraph_edge *edge)
 static inline int
 estimate_edge_growth (struct cgraph_edge *edge)
 {
-  gcc_checking_assert (ipa_call_summaries->get_create (edge)->call_stmt_size
-                      || !edge->callee->analyzed);
-  return (estimate_edge_size (edge)
-         - ipa_call_summaries->get_create (edge)->call_stmt_size);
+  ipa_call_summary *s = ipa_call_summaries->get_create (edge);
+  gcc_checking_assert (s->call_stmt_size || !edge->callee->analyzed);
+  return (estimate_edge_size (edge) - s->call_stmt_size);
 }
 
 /* Return estimated callee runtime increase after inlining