public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-9482] PR tree-optimization/109392 Date: Thu, 27 Apr 2023 13:19:10 +0000 (GMT) [thread overview] Message-ID: <20230427131910.E504D3858C60@sourceware.org> (raw) https://gcc.gnu.org/g:d639236ea87ff8a6a2d56c0408e6eb92674418e6 commit r12-9482-gd639236ea87ff8a6a2d56c0408e6eb92674418e6 Author: Jakub Jelinek <jakub@redhat.com> Date: Sat Apr 8 12:21:42 2023 -0600 PR tree-optimization/109392 If we have an object with SSA_NAME_OCCURS_IN_ABNORMAL_PHI, then maybe_push_res_to_seq may fail. Directly build the extraction for that case. PR tree-optimization/109392 gcc/ * tree-vect-generic.cc (tree_vec_extract): Handle failure of maybe_push_res_to_seq better. gcc/testsuite/ * gcc.dg/pr109392.c: New test. (cherry picked from commit 101380a8394c22a7a2ea70de2060ee93716156e2) Diff: --- gcc/testsuite/gcc.dg/pr109392.c | 15 +++++++++++++++ gcc/tree-vect-generic.cc | 11 ++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/pr109392.c b/gcc/testsuite/gcc.dg/pr109392.c new file mode 100644 index 00000000000..e5bd9d440fa --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr109392.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/109392 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wno-psabi" } */ + +typedef short __attribute__ ((__vector_size__ (64))) V; +V v, w; +void bar (void) __attribute__((returns_twice)); + +V +foo (V a, V b) +{ + bar (); + b &= v < b; + return (V) { foo (b, w)[3], (V) {}[3] }; +} diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index a84f5e4ca78..f282e69d53b 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -183,7 +183,16 @@ tree_vec_extract (gimple_stmt_iterator *gsi, tree type, opr.resimplify (NULL, follow_all_ssa_edges); gimple_seq stmts = NULL; tree res = maybe_push_res_to_seq (&opr, &stmts); - gcc_assert (res); + if (!res) + { + /* This can happen if SSA_NAME_OCCURS_IN_ABNORMAL_PHI are + used. Build BIT_FIELD_REF manually otherwise. */ + t = build3 (BIT_FIELD_REF, type, t, bitsize, bitpos); + res = make_ssa_name (type); + gimple *g = gimple_build_assign (res, t); + gsi_insert_before (gsi, g, GSI_SAME_STMT); + return res; + } gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); return res; }
reply other threads:[~2023-04-27 13:19 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=20230427131910.E504D3858C60@sourceware.org \ --to=rguenth@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).