public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fxue at os dot amperecomputing.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/113091] Over-estimate SLP vector-to-scalar cost for non-live pattern statement
Date: Tue, 26 Dec 2023 15:16:11 +0000	[thread overview]
Message-ID: <bug-113091-4-waDTsfkUZ3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113091-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113091

--- Comment #7 from Feng Xue <fxue at os dot amperecomputing.com> ---
> The issue here is that because the "outer" pattern consumes
> patt_64 = (int) patt_63 it should have adjusted _2 = (int) _1
> stmt-to-vectorize
> as being the outer pattern root stmt for all this logic to work correctly.

We could not simply make this adjustment since pattern recognition does not
require replaced SSA to be of single-use. If we change the above case to attach
another scalar use to "_2" as:

  int foo(char *a, char *b)
  {
    unsigned array[8];
    int a0 = a[0];  // _2 = (int) _1;

    array[0] = (a0 - b[0]);
    array[1] = (a[1] - b[1]);
    array[2] = (a[2] - b[2]);
    array[3] = (a[3] - b[3]);
    array[4] = (a[4] - b[4]);
    array[5] = (a[5] - b[5]);
    array[6] = (a[6] - b[6]);
    array[7] = (a[7] - b[7]);

    return test(array) + a0;
  }

The pattern statement "patt_64 = (int) patt_63" for "_2 = (int) _1" should be
kept. So we also need the check of "identifying whether a scalar stmt takes
part
in vectorization or not" to ensure the adjustment is doable.

  parent reply	other threads:[~2023-12-26 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  9:54 [Bug tree-optimization/113091] New: " fxue at os dot amperecomputing.com
2023-12-20 13:09 ` [Bug tree-optimization/113091] " rguenth at gcc dot gnu.org
2023-12-21  5:25 ` fxue at os dot amperecomputing.com
2023-12-21  5:27 ` fxue at os dot amperecomputing.com
2023-12-21  7:31 ` rguenth at gcc dot gnu.org
2023-12-21 11:01 ` rsandifo at gcc dot gnu.org
2023-12-22  3:55 ` fxue at os dot amperecomputing.com
2023-12-26 15:16 ` fxue at os dot amperecomputing.com [this message]
2023-12-29 10:35 ` fxue at os dot amperecomputing.com
2024-01-16  3:36 ` cvs-commit at gcc dot gnu.org
2024-01-31  3:13 ` fxue at os dot amperecomputing.com

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-113091-4-waDTsfkUZ3@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: link
Be 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).