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 c/97578] ice during IPA pass: inline
Date: Sun, 01 Nov 2020 14:48:56 +0000	[thread overview]
Message-ID: <bug-97578-4-dJ3Yde017D@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97578-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
this patch fixes the ICE, though I think we do have a design issue here
while producing debug info across ltrans boundary.

Martin, Jakub: as discussed on IRC it would be nice to add predicate
when the body is really needed and avoid materializing if it is not.
Can you add one?

Something like param_adjustemnts->need_callee_parm_decls_p ()

Honza

diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 4df1b7fb9ee..907a95cac5a 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -51,6 +51,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-modref-tree.h"
 #include "ipa-modref.h"
 #include "symtab-thunks.h"
+#include "symtab-clones.h"

 int ncalls_inlined;
 int nfunctions_inlined;
@@ -695,6 +696,31 @@ preserve_function_body_p (struct cgraph_node *node)
   return false;
 }

+/* tree-inline can not recurse; materialize all function bodie we will need
+   during inlining.  This includes inlined functions, but also called
functions
+   with param manipulation because IPA param manipulation attaches debug
+   statements to PARM_DECLs of called clone.  Materialize them if needed.
+
+   FIXME: This is somehwat broken by design because it does not play well
+   with partitioning.  */
+
+static void
+maybe_materialize_called_clones (cgraph_node *node)
+{
+  for (cgraph_edge *e = node->callees; e; e = e->next_callee)
+    {
+      clone_info *info;
+
+      if (!e->inline_failed)
+       maybe_materialize_called_clones (e->callee);
+
+      cgraph_node *callee = cgraph_node::get (e->callee->decl);
+      if (callee->clone_of
+         && (info = clone_info::get (callee)) && info->param_adjustments)
+       callee->get_untransformed_body ();
+    }
+}
+
 /* Apply inline plan to function.  */

 unsigned int
@@ -748,6 +774,7 @@ inline_transform (struct cgraph_node *node)
       ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = node->count;
     }

+  maybe_materialize_called_clones (node);
   for (e = node->callees; e; e = next)
     {
       if (!e->inline_failed)

  parent reply	other threads:[~2020-11-01 14:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 11:35 [Bug c/97578] New: " dcb314 at hotmail dot com
2020-10-26 11:46 ` [Bug c/97578] " marxin at gcc dot gnu.org
2020-10-26 12:21 ` dcb314 at hotmail dot com
2020-10-26 12:37 ` hubicka at gcc dot gnu.org
2020-10-31 12:55 ` su at cs dot ucdavis.edu
2020-11-01 14:48   ` Jan Hubicka
2020-11-01 14:48 ` hubicka at ucw dot cz [this message]
2020-11-02 16:26 ` jamborm at gcc dot gnu.org
2020-11-03 10:56 ` cvs-commit at gcc dot gnu.org
2020-11-03 11:19 ` hubicka at gcc dot gnu.org
2020-11-03 11:21 ` jakub at gcc dot gnu.org
2020-11-03 11:25   ` Jan Hubicka
2020-11-03 11:25 ` hubicka at ucw dot cz
2021-04-27 11:39 ` jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2022-04-13 15:07 ` [Bug c/97578] [11 Regression] " redi at gcc dot gnu.org
2022-04-13 15:09 ` jakub at gcc dot gnu.org
2022-04-13 16:23 ` dcb314 at hotmail dot com
2022-04-13 17:21 ` jamborm at gcc dot gnu.org
2022-04-21  7:48 ` rguenth at gcc dot gnu.org
2023-05-29 10:03 ` jakub at gcc dot gnu.org

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-97578-4-dJ3Yde017D@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).