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-3138] tree-optimization/102046 - fix SLP build from scalars with patterns Date: Wed, 25 Aug 2021 09:32:15 +0000 (GMT) [thread overview] Message-ID: <20210825093215.CB739385AC37@sourceware.org> (raw) https://gcc.gnu.org/g:29c77454e5ab33ce06a741eacdfbd5348fbccc95 commit r12-3138-g29c77454e5ab33ce06a741eacdfbd5348fbccc95 Author: Richard Biener <rguenther@suse.de> Date: Wed Aug 25 10:06:01 2021 +0200 tree-optimization/102046 - fix SLP build from scalars with patterns When we swap operands for SLP builds we lose track where exactly pattern defs are - but we fail to update the any_pattern member of the operands info. Do so conservatively. 2021-08-25 Richard Biener <rguenther@suse.de> PR tree-optimization/102046 * tree-vect-slp.c (vect_build_slp_tree_2): Conservatively update ->any_pattern when swapping operands. * gcc.dg/vect/pr102046.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/vect/pr102046.c | 19 +++++++++++++++++++ gcc/tree-vect-slp.c | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/gcc/testsuite/gcc.dg/vect/pr102046.c b/gcc/testsuite/gcc.dg/vect/pr102046.c new file mode 100644 index 00000000000..ae48b497dc0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr102046.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -fvect-cost-model=dynamic" } */ +/* { dg-additional-options "-march=btver2" { target x86_64-*-* i?86-*-* } } */ + +struct S +{ + unsigned a, b; +}; + +struct S g; + +void +foo (struct S *o) +{ + struct S s = g; + s.b *= 3; + s.a -= s.a / 2; + *o = s; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index edc11c62793..4d688c7a267 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2311,6 +2311,10 @@ out: } if (dump_enabled_p ()) dump_printf (MSG_NOTE, "\n"); + /* After swapping some operands we lost track whether an + operand has any pattern defs so be conservative here. */ + if (oprnds_info[0]->any_pattern || oprnds_info[1]->any_pattern) + oprnds_info[0]->any_pattern = oprnds_info[1]->any_pattern = true; /* And try again with scratch 'matches' ... */ bool *tem = XALLOCAVEC (bool, group_size); if ((child = vect_build_slp_tree (vinfo, oprnd_info->def_stmts,
reply other threads:[~2021-08-25 9:32 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=20210825093215.CB739385AC37@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).