ipa-cp.c (propagate_constants_across_call): If args are not available just drop every...
authorJan Hubicka <hubicka@ucw.cz>
Sun, 27 Oct 2019 08:11:57 +0000 (09:11 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 27 Oct 2019 08:11:57 +0000 (08:11 +0000)
* ipa-cp.c (propagate_constants_across_call): If args are not available
just drop everything to varying.
(find_aggregate_values_for_callers_subset): Watch for missing
edge summary.
(find_more_scalar_values_for_callers_subs): Likewise.
* ipa-prop.c (ipa_compute_jump_functions_for_edge,
update_jump_functions_after_inlining, propagate_controlled_uses):
Watch for missing summaries.
(ipa_propagate_indirect_call_infos): Remove summary after propagation
is finished.
(ipa_write_node_info): Watch for missing summaries.
(ipa_read_edge_info): Create new ref.
(ipa_edge_args_sum_t): Add remove.
(IPA_EDGE_REF_GET_CREATE): New macro.
* ipa-fnsummary.c (evaluate_properties_for_edge): Watch for missing
edge summary.
(remap_edge_change_prob): Likewise.

From-SVN: r277484

gcc/ChangeLog
gcc/ipa-cp.c
gcc/ipa-fnsummary.c
gcc/ipa-prop.c
gcc/ipa-prop.h

index 15fd0be7bd06ba19c8976ab0903f307454808903..3bfbf1623ebd9c4090f9d101d1080991c2b77b18 100644 (file)
@@ -1,3 +1,23 @@
+2019-10-27  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-cp.c (propagate_constants_across_call): If args are not available
+       just drop everything to varying.
+       (find_aggregate_values_for_callers_subset): Watch for missing
+       edge summary.
+       (find_more_scalar_values_for_callers_subs): Likewise.
+       * ipa-prop.c (ipa_compute_jump_functions_for_edge,
+       update_jump_functions_after_inlining, propagate_controlled_uses):
+       Watch for missing summaries.
+       (ipa_propagate_indirect_call_infos): Remove summary after propagation
+       is finished.
+       (ipa_write_node_info): Watch for missing summaries.
+       (ipa_read_edge_info): Create new ref.
+       (ipa_edge_args_sum_t): Add remove.
+       (IPA_EDGE_REF_GET_CREATE): New macro.
+       * ipa-fnsummary.c (evaluate_properties_for_edge): Watch for missing
+       edge summary.
+       (remap_edge_change_prob): Likewise.
+
 2019-10-27  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-inline-transform.c (inline_call): update function summaries
index f5852dcca8edd6876124fe948640127e1512fa6d..23028e28a16bcbc4785b1a4b5ca86e959fc63716 100644 (file)
@@ -2309,10 +2309,17 @@ propagate_constants_across_call (struct cgraph_edge *cs)
   callee_info = IPA_NODE_REF (callee);
 
   args = IPA_EDGE_REF (cs);
-  args_count = ipa_get_cs_argument_count (args);
   parms_count = ipa_get_param_count (callee_info);
   if (parms_count == 0)
     return false;
+  if (!args)
+    {
+      for (i = 0; i < parms_count; i++)
+       ret |= set_all_contains_variable (ipa_get_parm_lattices (callee_info,
+                                                                i));
+      return ret;
+    }
+  args_count = ipa_get_cs_argument_count (args);
 
   /* If this call goes through a thunk we must not propagate to the first (0th)
      parameter.  However, we might need to uncover a thunk from below a series
@@ -4066,7 +4073,8 @@ find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
          if (IPA_NODE_REF (cs->caller)->node_dead)
            continue;
 
-         if (i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
+         if (!IPA_EDGE_REF (cs)
+             || i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
              || (i == 0
                  && call_passes_through_thunk_p (cs)))
            {
@@ -4135,7 +4143,8 @@ find_more_contexts_for_caller_subset (cgraph_node *node,
 
       FOR_EACH_VEC_ELT (callers, j, cs)
        {
-         if (i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs)))
+         if (!IPA_EDGE_REF (cs)
+             || i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs)))
            return;
          ipa_jump_func *jfunc = ipa_get_ith_jump_func (IPA_EDGE_REF (cs),
                                                            i);
@@ -4451,6 +4460,11 @@ find_aggregate_values_for_callers_subset (struct cgraph_node *node,
 
   FOR_EACH_VEC_ELT (callers, j, cs)
     {
+      if (!IPA_EDGE_REF (cs))
+       {
+         count = 0;
+         break;
+       }
       int c = ipa_get_cs_argument_count (IPA_EDGE_REF (cs));
       if (c < count)
        count = c;
index d6b6319c5f6f4a01c49297fb2b498b6e8d8daafc..ce384dfc9f0c26f032f971639eefb66171533a34 100644 (file)
@@ -452,6 +452,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
   class ipa_fn_summary *info = ipa_fn_summaries->get (callee);
   vec<tree> known_vals = vNULL;
   vec<ipa_agg_jump_function_p> known_aggs = vNULL;
+  class ipa_edge_args *args;
 
   if (clause_ptr)
     *clause_ptr = inline_p ? 0 : 1 << predicate::not_inlined_condition;
@@ -462,10 +463,10 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
 
   if (ipa_node_params_sum
       && !e->call_stmt_cannot_inline_p
-      && ((clause_ptr && info->conds) || known_vals_ptr || known_contexts_ptr))
+      && ((clause_ptr && info->conds) || known_vals_ptr || known_contexts_ptr)
+      && (args = IPA_EDGE_REF (e)) != NULL)
     {
       class ipa_node_params *caller_parms_info, *callee_pi;
-      class ipa_edge_args *args = IPA_EDGE_REF (e);
       class ipa_call_summary *es = ipa_call_summaries->get (e);
       int i, count = ipa_get_cs_argument_count (args);
 
@@ -3160,6 +3161,8 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge,
     {
       int i;
       class ipa_edge_args *args = IPA_EDGE_REF (edge);
+      if (!args)
+       return;
       class ipa_call_summary *es = ipa_call_summaries->get (edge);
       class ipa_call_summary *inlined_es
        = ipa_call_summaries->get (inlined_edge);
index 5020f4a44d5afce521c65cd703d2eae7e3e11b6a..1290a2f39433598337b079d75556aa578dcf66cb 100644 (file)
@@ -1854,7 +1854,7 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
                                     struct cgraph_edge *cs)
 {
   class ipa_node_params *info = IPA_NODE_REF (cs->caller);
-  class ipa_edge_args *args = IPA_EDGE_REF (cs);
+  class ipa_edge_args *args = IPA_EDGE_REF_GET_CREATE (cs);
   gcall *call = cs->call_stmt;
   int n, arg_num = gimple_call_num_args (call);
   bool useful_context = false;
@@ -2652,6 +2652,8 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
 {
   class ipa_edge_args *top = IPA_EDGE_REF (cs);
   class ipa_edge_args *args = IPA_EDGE_REF (e);
+  if (!args)
+    return;
   int count = ipa_get_cs_argument_count (args);
   int i;
 
@@ -3575,6 +3577,8 @@ static void
 propagate_controlled_uses (struct cgraph_edge *cs)
 {
   class ipa_edge_args *args = IPA_EDGE_REF (cs);
+  if (!args)
+    return;
   struct cgraph_node *new_root = cs->caller->global.inlined_to
     ? cs->caller->global.inlined_to : cs->caller;
   class ipa_node_params *new_root_info = IPA_NODE_REF (new_root);
@@ -3702,6 +3706,7 @@ ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
 
   propagate_controlled_uses (cs);
   changed = propagate_info_to_inlined_callees (cs, cs->callee, new_edges);
+  ipa_edge_args_sum->remove (cs);
 
   return changed;
 }
@@ -4380,6 +4385,12 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
     {
       class ipa_edge_args *args = IPA_EDGE_REF (e);
 
+      if (!args)
+       {
+         streamer_write_uhwi (ob, 0);
+         continue;
+       }
+
       streamer_write_uhwi (ob,
                           ipa_get_cs_argument_count (args) * 2
                           + (args->polymorphic_call_contexts != NULL));
@@ -4393,15 +4404,19 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
   for (e = node->indirect_calls; e; e = e->next_callee)
     {
       class ipa_edge_args *args = IPA_EDGE_REF (e);
-
-      streamer_write_uhwi (ob,
-                          ipa_get_cs_argument_count (args) * 2
-                          + (args->polymorphic_call_contexts != NULL));
-      for (j = 0; j < ipa_get_cs_argument_count (args); j++)
+      if (!args)
+       streamer_write_uhwi (ob, 0);
+      else
        {
-         ipa_write_jump_function (ob, ipa_get_ith_jump_func (args, j));
-         if (args->polymorphic_call_contexts != NULL)
-           ipa_get_ith_polymorhic_call_context (args, j)->stream_out (ob);
+         streamer_write_uhwi (ob,
+                              ipa_get_cs_argument_count (args) * 2
+                              + (args->polymorphic_call_contexts != NULL));
+         for (j = 0; j < ipa_get_cs_argument_count (args); j++)
+           {
+             ipa_write_jump_function (ob, ipa_get_ith_jump_func (args, j));
+             if (args->polymorphic_call_contexts != NULL)
+               ipa_get_ith_polymorhic_call_context (args, j)->stream_out (ob);
+           }
        }
       ipa_write_indirect_edge_info (ob, e);
     }
@@ -4422,7 +4437,7 @@ ipa_read_edge_info (class lto_input_block *ib,
     return;
   if (prevails && e->possibly_call_in_translation_unit_p ())
     {
-      class ipa_edge_args *args = IPA_EDGE_REF (e);
+      class ipa_edge_args *args = IPA_EDGE_REF_GET_CREATE (e);
       vec_safe_grow_cleared (args->jump_functions, count);
       if (contexts_computed)
        vec_safe_grow_cleared (args->polymorphic_call_contexts, count);
index aba996fba9406ba67b698b39a707c6fa9674f53e..6811ed765df1e0ca3a67e9fd8126c6b43b5aad93 100644 (file)
@@ -640,6 +640,11 @@ class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *>
   ipa_edge_args_sum_t (symbol_table *table, bool ggc)
     : call_summary<ipa_edge_args *> (table, ggc) { }
 
+  void remove (cgraph_edge *edge)
+  {
+    call_summary <ipa_edge_args *>::remove (edge);
+  }
+
   /* Hook that is called by summary when an edge is removed.  */
   virtual void remove (cgraph_edge *cs, ipa_edge_args *args);
   /* Hook that is called by summary when an edge is duplicated.  */
@@ -679,7 +684,8 @@ extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum
 /* Return the associated parameter/argument info corresponding to the given
    node/edge.  */
 #define IPA_NODE_REF(NODE) (ipa_node_params_sum->get_create (NODE))
-#define IPA_EDGE_REF(EDGE) (ipa_edge_args_sum->get_create (EDGE))
+#define IPA_EDGE_REF(EDGE) (ipa_edge_args_sum->get (EDGE))
+#define IPA_EDGE_REF_GET_CREATE(EDGE) (ipa_edge_args_sum->get_create (EDGE))
 /* This macro checks validity of index returned by
    ipa_get_param_decl_index function.  */
 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)