public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-2086] Use cvt_op to save intermediate type operand instead of "subtle" vec_dest. Date: Mon, 26 Jun 2023 07:49:27 +0000 (GMT) [thread overview] Message-ID: <20230626074927.081C03858D20@sourceware.org> (raw) https://gcc.gnu.org/g:1bfe7e5352d1f4ac525317454aca45aa80a517ba commit r14-2086-g1bfe7e5352d1f4ac525317454aca45aa80a517ba Author: liuhongt <hongtao.liu@intel.com> Date: Sun Jun 25 11:12:29 2023 +0800 Use cvt_op to save intermediate type operand instead of "subtle" vec_dest. When there're multiple operands in vec_oprnds0, vec_dest will be overwrited to vectype_out, but in multi_step_cvt case, cvt_type is expected. It caused an ICE when verify_gimple_in_cfg. gcc/ChangeLog: PR tree-optimization/110371 PR tree-optimization/110018 * tree-vect-stmts.cc (vectorizable_conversion): Use cvt_op to save intermediate type operand instead of "subtle" vec_dest for case NONE. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr110371.c: New test. Diff: --- gcc/testsuite/gcc.target/aarch64/pr110371.c | 20 ++++++++++++++++++++ gcc/tree-vect-stmts.cc | 14 ++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gcc.target/aarch64/pr110371.c b/gcc/testsuite/gcc.target/aarch64/pr110371.c new file mode 100644 index 00000000000..444e514e04f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr110371.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef struct dest +{ + double m[3][3]; +} dest; + +typedef struct src +{ + int m[3][3]; +} src; + +void +foo (dest *a, src* s) +{ + for (int i = 0; i != 3; i++) + for (int j = 0; j != 3; j++) + a->m[i][j] = s->m[i][j]; +} diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 7d24bbee152..bf61461939b 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -5044,7 +5044,7 @@ vectorizable_conversion (vec_info *vinfo, gimple **vec_stmt, slp_tree slp_node, stmt_vector_for_cost *cost_vec) { - tree vec_dest; + tree vec_dest, cvt_op = NULL_TREE; tree scalar_dest; tree op0, op1 = NULL_TREE; loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo); @@ -5569,6 +5569,13 @@ vectorizable_conversion (vec_info *vinfo, case NONE: vect_get_vec_defs (vinfo, stmt_info, slp_node, ncopies, op0, &vec_oprnds0); + /* vec_dest is intermediate type operand when multi_step_cvt. */ + if (multi_step_cvt) + { + cvt_op = vec_dest; + vec_dest = vec_dsts[0]; + } + FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0) { /* Arguments are ready, create the new vector stmt. */ @@ -5576,12 +5583,11 @@ vectorizable_conversion (vec_info *vinfo, if (multi_step_cvt) { gcc_assert (multi_step_cvt == 1); - new_stmt = vect_gimple_build (vec_dest, codecvt1, vop0); - new_temp = make_ssa_name (vec_dest, new_stmt); + new_stmt = vect_gimple_build (cvt_op, codecvt1, vop0); + new_temp = make_ssa_name (cvt_op, new_stmt); gimple_assign_set_lhs (new_stmt, new_temp); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); vop0 = new_temp; - vec_dest = vec_dsts[0]; } new_stmt = vect_gimple_build (vec_dest, code1, vop0); new_temp = make_ssa_name (vec_dest, new_stmt);
reply other threads:[~2023-06-26 7:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230626074927.081C03858D20@sourceware.org \ --to=liuhongt@gcc.gnu.org \ --cc=gcc-cvs@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).