From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D12738618AA; Sun, 1 Nov 2020 14:48:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D12738618AA From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/97578] ice during IPA pass: inline Date: Sun, 01 Nov 2020 14:48:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 14:48:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97578 --- Comment #5 from Jan Hubicka --- 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 =3D node->callees; e; e =3D e->next_callee) + { + clone_info *info; + + if (!e->inline_failed) + maybe_materialize_called_clones (e->callee); + + cgraph_node *callee =3D cgraph_node::get (e->callee->decl); + if (callee->clone_of + && (info =3D 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 =3D node->count; } + maybe_materialize_called_clones (node); for (e =3D node->callees; e; e =3D next) { if (!e->inline_failed)=