re PR middle-end/58094 (IPA devirt testsuite errors)
authorJan Hubicka <jh@suse.cz>
Fri, 13 Sep 2013 14:35:32 +0000 (16:35 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 13 Sep 2013 14:35:32 +0000 (14:35 +0000)
PR middle-end/58094
* ipa-inline.c (check_callers): New function.
(check_caller_edge): Remove.
(want_inline_function_to_all_callers_p): Also permit alises that are
called dirrectly.
(inline_to_all_callers): Terminate the walk when devirtualization
introduce new calls.

From-SVN: r202567

gcc/ChangeLog
gcc/ipa-inline.c

index 34d39d24534c162322d3996fbe8ed0803d1b1185..add64c0853574c1eaf8056bd71659d03d420650d 100644 (file)
@@ -1,3 +1,13 @@
+2013-09-13  Jan Hubicka  <jh@suse.cz>
+
+       PR middle-end/58094
+       * ipa-inline.c (check_callers): New function.
+       (check_caller_edge): Remove.
+       (want_inline_function_to_all_callers_p): Also permit alises that are
+       called dirrectly.
+       (inline_to_all_callers): Terminate the walk when devirtualization
+       introduce new calls.
+
 2013-09-13  Jan Hubicka  <jh@suse.cz>
 
        * ipa-inline-analysis.c (struct growth_data): Add node.
index 5aa8917545e260445ccead7faa377a5805a19f8b..266c048672850e47052741e1ed77c98c421ae3d1 100644 (file)
@@ -740,14 +740,22 @@ want_inline_self_recursive_call_p (struct cgraph_edge *edge,
   return want_inline;
 }
 
-/* Return true when NODE has caller other than EDGE. 
+/* Return true when NODE has uninlinable caller;
+   set HAS_HOT_CALL if it has hot call. 
    Worker for cgraph_for_node_and_aliases.  */
 
 static bool
-check_caller_edge (struct cgraph_node *node, void *edge)
+check_callers (struct cgraph_node *node, void *has_hot_call)
 {
-  return (node->callers
-          && node->callers != edge);
+  struct cgraph_edge *e;
+   for (e = node->callers; e; e = e->next_caller)
+     {
+       if (!can_inline_edge_p (e, true))
+         return true;
+       if (!has_hot_call && cgraph_maybe_hot_edge_p (e))
+        *(bool *)has_hot_call = true;
+     }
+  return false;
 }
 
 /* If NODE has a caller, return true.  */
@@ -768,7 +776,6 @@ static bool
 want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold)
 {
    struct cgraph_node *function = cgraph_function_or_thunk_node (node, NULL);
-   struct cgraph_edge *e;
    bool has_hot_call = false;
 
    /* Does it have callers?  */
@@ -782,18 +789,9 @@ want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold)
    /* Inlining into all callers would increase size?  */
    if (estimate_growth (node) > 0)
      return false;
-   /* Maybe other aliases has more direct calls.  */
-   if (cgraph_for_node_and_aliases (node, check_caller_edge, node->callers, true))
-     return false;
    /* All inlines must be possible.  */
-   for (e = node->callers; e; e = e->next_caller)
-     {
-       if (!can_inline_edge_p (e, true))
-         return false;
-       if (!has_hot_call && cgraph_maybe_hot_edge_p (e))
-        has_hot_call = 1;
-     }
-
+   if (cgraph_for_node_and_aliases (node, check_callers, &has_hot_call, true))
+     return false;
    if (!cold && !has_hot_call)
      return false;
    return true;
@@ -1949,7 +1947,7 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
        {
          if (dump_file)
            fprintf (dump_file, "New calls found; giving up.\n");
-         break;
+         return true;
        }
     }
   return false;