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 r12-1009] Fix ICE when lhs is NULL. Date: Mon, 24 May 2021 01:21:33 +0000 (GMT) [thread overview] Message-ID: <20210524012133.DFB99385800F@sourceware.org> (raw) https://gcc.gnu.org/g:dc084c487e997e7f47cee55467628ade4488538b commit r12-1009-gdc084c487e997e7f47cee55467628ade4488538b Author: liuhongt <hongtao.liu@intel.com> Date: Thu May 20 09:59:36 2021 +0800 Fix ICE when lhs is NULL. gcc/ChangeLog: PR target/100660 * config/i386/i386.c (ix86_gimple_fold_builtin): Replacing stmt with GIMPLE_NOP when lhs doesn't exist. gcc/testsuite/ChangeLog: PR target/100660 * gcc.target/i386/pr100660.c: New test. Diff: --- gcc/config/i386/i386.c | 33 +++++++++++++++++--------------- gcc/testsuite/gcc.target/i386/pr100660.c | 10 ++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f3b451835da..28e6113a609 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -17991,21 +17991,24 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi) gcc_assert (n_args == 2); arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); - { - location_t loc = gimple_location (stmt); - tree type = TREE_TYPE (arg0); - tree zero_vec = build_zero_cst (type); - tree minus_one_vec = build_minus_one_cst (type); - tree cmp_type = truth_type_for (type); - gimple_seq stmts = NULL; - tree cmp = gimple_build (&stmts, tcode, cmp_type, arg0, arg1); - gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); - gimple* g = gimple_build_assign (gimple_call_lhs (stmt), - VEC_COND_EXPR, cmp, - minus_one_vec, zero_vec); - gimple_set_location (g, loc); - gsi_replace (gsi, g, false); - } + if (gimple_call_lhs (stmt)) + { + location_t loc = gimple_location (stmt); + tree type = TREE_TYPE (arg0); + tree zero_vec = build_zero_cst (type); + tree minus_one_vec = build_minus_one_cst (type); + tree cmp_type = truth_type_for (type); + gimple_seq stmts = NULL; + tree cmp = gimple_build (&stmts, tcode, cmp_type, arg0, arg1); + gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); + gimple* g = gimple_build_assign (gimple_call_lhs (stmt), + VEC_COND_EXPR, cmp, + minus_one_vec, zero_vec); + gimple_set_location (g, loc); + gsi_replace (gsi, g, false); + } + else + gsi_replace (gsi, gimple_build_nop (), false); return true; case IX86_BUILTIN_PSLLD: diff --git a/gcc/testsuite/gcc.target/i386/pr100660.c b/gcc/testsuite/gcc.target/i386/pr100660.c new file mode 100644 index 00000000000..1112b742779 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100660.c @@ -0,0 +1,10 @@ +/* PR target/pr100660. */ +/* { dg-do compile } */ +/* { dg-options "-mavx2 -O" } */ + +typedef char v16qi __attribute__ ((vector_size (16))); +v16qi +f5 (v16qi a, v16qi b) +{ + __builtin_ia32_pcmpgtb128 (a, b); +}
reply other threads:[~2021-05-24 1:21 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=20210524012133.DFB99385800F@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).