public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/105554] [10/11/12/13 Regression] ICE: in emit_block_move_hints, at expr.cc:1829 since r9-5509-g5928bc2ec06dd4e7 Date: Fri, 17 Mar 2023 18:00:51 +0000 [thread overview] Message-ID: <bug-105554-4-wksk82qtKi@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105554-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105554 --- Comment #21 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:24c06560a7fa39049911eeb8777325d112e0deb9 commit r13-6739-g24c06560a7fa39049911eeb8777325d112e0deb9 Author: Jakub Jelinek <jakub@redhat.com> Date: Fri Mar 17 18:59:56 2023 +0100 tree-inline: Fix up multiversioning with vector arguments [PR105554] The following testcase ICEs, because we call tree_function_versioning from old_decl which has target attributes not supporting V4DImode and so DECL_MODE of DECL_ARGUMENTS is BLKmode, while new_decl supports those. tree_function_versioning initially copies DECL_RESULT and DECL_ARGUMENTS from old_decl to new_decl, then calls initialize_cfun to create cfun and only when the cfun is created it can later actually remap_decl DECL_RESULT and DECL_ARGUMENTS etc. The problem is that initialize_cfun -> push_struct_function -> allocate_struct_function calls relayout_decl on DECL_RESULT and DECL_ARGUMENTS, which clobbers DECL_MODE of old_decl and we then ICE because of it. In particular, allocate_struct_function does: if (!abstract_p) { /* Now that we have activated any function-specific attributes that might affect layout, particularly vector modes, relayout each of the parameters and the result. */ relayout_decl (result); for (tree parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) relayout_decl (parm); /* Similarly relayout the function decl. */ targetm.target_option.relayout_function (fndecl); } if (!abstract_p && aggregate_value_p (result, fndecl)) { #ifdef PCC_STATIC_STRUCT_RETURN cfun->returns_pcc_struct = 1; #endif cfun->returns_struct = 1; } Now, in the case of tree_function_versioning, I believe all that we need from these is possibly the targetm.target_option.relayout_function (fndecl); call (arm only), we will remap DECL_RESULT and DECL_ARGUMENTS later on and copy_decl_for_dup_finish in that case will handle all we need: /* For vector typed decls make sure to update DECL_MODE according to the new function context. */ if (VECTOR_TYPE_P (TREE_TYPE (copy))) SET_DECL_MODE (copy, TYPE_MODE (TREE_TYPE (copy))); We don't need the cfun->returns_*struct either, because we override it in initialize_cfun a few lines later: /* Copy items we preserve during cloning. */ ... cfun->returns_struct = src_cfun->returns_struct; cfun->returns_pcc_struct = src_cfun->returns_pcc_struct; So, to avoid the clobbering of DECL_RESULT/DECL_ARGUMENTS of old_decl, the following patch arranges allocate_struct_function to be called with abstract_p true and calls targetm.target_option.relayout_function (fndecl); by hand. The removal of DECL_RESULT/DECL_ARGUMENTS copying at the start of initialize_cfun is removed because the only caller - tree_function_versioning, does that unconditionally before. 2023-03-17 Jakub Jelinek <jakub@redhat.com> PR target/105554 * function.h (push_struct_function): Add ABSTRACT_P argument defaulted to false. * function.cc (push_struct_function): Add ABSTRACT_P argument, pass it to allocate_struct_function instead of false. * tree-inline.cc (initialize_cfun): Don't copy DECL_ARGUMENTS nor DECL_RESULT here. Pass true as ABSTRACT_P to push_struct_function. Call targetm.target_option.relayout_function after it. (tree_function_versioning): Formatting fix. * gcc.target/i386/pr105554.c: New test.
next prev parent reply other threads:[~2023-03-17 18:00 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-10 20:03 [Bug c/105554] New: ICE: in emit_block_move_hints, at expr.cc:1829 zhenyang.xu at uwaterloo dot ca 2022-05-11 7:33 ` [Bug target/105554] " marxin at gcc dot gnu.org 2022-05-11 7:42 ` rguenth at gcc dot gnu.org 2022-05-11 7:47 ` [Bug target/105554] [9/10/11/12/13 Regression] ICE: in emit_block_move_hints, at expr.cc:1829 since r9-5509-g5928bc2ec06dd4e7 marxin at gcc dot gnu.org 2022-05-11 7:49 ` jakub at gcc dot gnu.org 2022-05-27 9:48 ` [Bug target/105554] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:49 ` jakub at gcc dot gnu.org 2022-07-26 11:28 ` rguenth at gcc dot gnu.org 2023-01-11 12:27 ` marxin at gcc dot gnu.org 2023-01-11 13:01 ` rguenth at gcc dot gnu.org 2023-01-11 13:03 ` rguenth at gcc dot gnu.org 2023-01-16 12:53 ` marxin at gcc dot gnu.org 2023-01-16 13:01 ` rguenther at suse dot de 2023-02-09 11:51 ` marxin at gcc dot gnu.org 2023-02-09 12:52 ` rguenth at gcc dot gnu.org 2023-03-16 14:04 ` marxin at gcc dot gnu.org 2023-03-16 18:07 ` jakub at gcc dot gnu.org 2023-03-16 18:47 ` jakub at gcc dot gnu.org 2023-03-16 18:55 ` jakub at gcc dot gnu.org 2023-03-17 8:59 ` rguenth at gcc dot gnu.org 2023-03-17 9:24 ` jakub at gcc dot gnu.org 2023-03-17 9:28 ` jakub at gcc dot gnu.org 2023-03-17 9:31 ` rguenth at gcc dot gnu.org 2023-03-17 10:02 ` jakub at gcc dot gnu.org 2023-03-17 18:00 ` cvs-commit at gcc dot gnu.org [this message] 2023-03-17 18:06 ` [Bug target/105554] [10/11/12 " jakub at gcc dot gnu.org 2023-03-19 5:31 ` cvs-commit at gcc dot gnu.org 2023-03-20 10:29 ` [Bug target/105554] [10/11 " jakub at gcc dot gnu.org 2023-05-02 20:16 ` cvs-commit at gcc dot gnu.org 2023-05-03 9:25 ` [Bug target/105554] [10 " jakub at gcc dot gnu.org 2023-05-03 15:22 ` cvs-commit at gcc dot gnu.org 2023-05-04 7:16 ` 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-105554-4-wksk82qtKi@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: linkBe 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).