public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/60984] [4.9 Regression] AIX: gcc-4.9.0 bootstrap fails in stage-2
Date: Tue, 20 May 2014 22:48:00 -0000	[thread overview]
Message-ID: <bug-60984-4-WYlSFO5lkw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-60984-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60984

--- Comment #24 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
the problem turns out to be quite ugly issue where inline_call removes dead
alias, but the alias is being walked by cgraph_for_node_and_aliases used
by ipa-inline to inline function into all callees.
The attached patch (I am still testing) makes us to restart the walk in this
case.

Honza

Index: ipa-inline-transform.c
===================================================================
--- ipa-inline-transform.c    (revision 210624)
+++ ipa-inline-transform.c    (working copy)
@@ -214,6 +214,7 @@
    it is NULL. If UPDATE_OVERALL_SUMMARY is false, do not bother to recompute
overall
    size of caller after inlining. Caller is required to eventually do it via
    inline_update_overall_summary.
+   If callee_removed is non-NULL, set it to true if we removed callee node.

    Return true iff any new callgraph edges were discovered as a
    result of inlining.  */
@@ -221,7 +222,8 @@
 bool
 inline_call (struct cgraph_edge *e, bool update_original,
          vec<cgraph_edge_p> *new_edges,
-         int *overall_size, bool update_overall_summary)
+         int *overall_size, bool update_overall_summary,
+         bool *callee_removed)
 {
   int old_size = 0, new_size = 0;
   struct cgraph_node *to = NULL;
@@ -260,6 +262,8 @@
         {
           next_alias = cgraph_alias_target (alias);
           cgraph_remove_node (alias);
+          if (callee_removed)
+        *callee_removed = true;
           alias = next_alias;
         }
       else
Index: ipa-inline.c
===================================================================
--- ipa-inline.c    (revision 210624)
+++ ipa-inline.c    (working copy)
@@ -1971,6 +1971,8 @@
 inline_to_all_callers (struct cgraph_node *node, void *data)
 {
   int *num_calls = (int *)data;
+  bool callee_removed = false;
+
   while (node->callers && !node->global.inlined_to)
     {
       struct cgraph_node *caller = node->callers->caller;
@@ -1987,7 +1989,7 @@
            inline_summary (node->callers->caller)->size);
     }

-      inline_call (node->callers, true, NULL, NULL, true);
+      inline_call (node->callers, true, NULL, NULL, true, &callee_removed);
       if (dump_file)
     fprintf (dump_file,
          " Inlined into %s which now has %i size\n",
@@ -1997,8 +1999,10 @@
     {
       if (dump_file)
         fprintf (dump_file, "New calls found; giving up.\n");
-      return true;
+      return callee_removed;
     }
+      if (callee_removed)
+    return true;
     }
   return false;
 }
@@ -2244,8 +2248,9 @@
           int num_calls = 0;
           cgraph_for_node_and_aliases (node, sum_callers,
                        &num_calls, true);
-          cgraph_for_node_and_aliases (node, inline_to_all_callers,
-                       &num_calls, true);
+          while (cgraph_for_node_and_aliases (node, inline_to_all_callers,
+                              &num_calls, true))
+        ;
           remove_functions = true;
         }
     }
Index: ipa-inline.h
===================================================================
--- ipa-inline.h    (revision 210624)
+++ ipa-inline.h    (working copy)
@@ -236,7 +236,8 @@
 bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining);

 /* In ipa-inline-transform.c  */
-bool inline_call (struct cgraph_edge *, bool, vec<cgraph_edge_p> *, int *,
bool);
+bool inline_call (struct cgraph_edge *, bool, vec<cgraph_edge_p> *, int *,
bool,
+          bool *callee_removed = NULL);
 unsigned int inline_transform (struct cgraph_node *);
 void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *,
               int freq_scale);


  parent reply	other threads:[~2014-05-20 22:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28  9:05 [Bug bootstrap/60984] New: " tgard at opentext dot com
2014-04-28 13:46 ` [Bug bootstrap/60984] " dje at gcc dot gnu.org
2014-04-28 19:23 ` dje at gcc dot gnu.org
2014-04-28 19:41 ` dje at gcc dot gnu.org
2014-04-28 22:09 ` dje at gcc dot gnu.org
2014-04-29  7:49 ` jakub at gcc dot gnu.org
2014-04-29  7:55 ` [Bug bootstrap/60984] [4.9 Regression] " rguenth at gcc dot gnu.org
2014-04-29 12:54 ` dje at gcc dot gnu.org
2014-04-29 14:11 ` tgard at opentext dot com
2014-04-29 17:01 ` dje at gcc dot gnu.org
2014-04-29 17:56 ` dje at gcc dot gnu.org
2014-05-02  7:59 ` tgard at opentext dot com
2014-05-02 13:29 ` tgard at opentext dot com
2014-05-04 20:13 ` dje at gcc dot gnu.org
2014-05-05  7:18 ` tgard at opentext dot com
2014-05-05 15:25 ` tgard at opentext dot com
2014-05-08  1:18 ` dje at gcc dot gnu.org
2014-05-08  2:05 ` dje at gcc dot gnu.org
2014-05-08  3:00 ` dje at gcc dot gnu.org
2014-05-08 17:42 ` dje at gcc dot gnu.org
2014-05-09 14:29 ` hubicka at gcc dot gnu.org
2014-05-09 15:44 ` dje at gcc dot gnu.org
2014-05-09 15:53 ` dje at gcc dot gnu.org
2014-05-10 14:57 ` dje at gcc dot gnu.org
2014-05-10 15:34 ` dje at gcc dot gnu.org
2014-05-20 22:48 ` hubicka at ucw dot cz [this message]
2014-05-20 23:02 ` dje at gcc dot gnu.org
2014-05-20 23:23 ` hubicka at ucw dot cz
2014-05-21  1:45 ` dje at gcc dot gnu.org
2014-05-21  5:40 ` hubicka at gcc dot gnu.org
2014-05-21  5:42 ` hubicka at gcc dot gnu.org
2014-05-21  5:45 ` hubicka at gcc dot gnu.org
2014-05-22 12:11 ` tgard at opentext dot com
2014-05-22 21:06 ` fbissey at slingshot dot co.nz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-60984-4-WYlSFO5lkw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).