public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105363] -ftree-slp-vectorize decreases performance significantly (x64)
Date: Mon, 25 Apr 2022 03:16:28 +0000	[thread overview]
Message-ID: <bug-105363-4-KYoH4XVw9o@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105363-4@http.gcc.gnu.org/bugzilla/>

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

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crazylht at gmail dot com

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
STLF issues here.
 Performance counter stats for './12.out':

     1,248,728,604      ld_blocks.store_forward:u

       5.756169101 seconds time elapsed

       5.746946000 seconds user
       0.001999000 seconds sys


and this case doens't need IPA, it's SLP inside the loop which has
cross-iteration data-dependence, I think we need to prevent that.

#define N 50000
int a[N];

void insertionsort(int a[], int n)
{
  int i, j;

  for (i = 1; i < n; i++) {
    for (j = i-1; j >= 0 && a[j] > a[j+1]; j--) {
      int t  = a[j+1];
      a[j+1] = a[j];
      a[j]   = t;
    }
  }
}

dump:

  <bb 5> [local count: 958878294]:
  MEM <vector(2) int> [(int *)_37] = vect__4.9_45;
  ivtmp.17_47 = ivtmp.17_28 + 18446744073709551612;
  if (_11 != ivtmp.17_47)
    goto <bb 7>; [94.50%]
  else
    goto <bb 6>; [5.50%]

  <bb 6> [local count: 114863531]:
  ivtmp.25_50 = ivtmp.25_9 + 1;
  ivtmp.28_52 = ivtmp.28_51 + 4;
  if (ivtmp.25_50 != _59)
    goto <bb 4>; [89.00%]
  else
    goto <bb 8>; [11.00%]

  <bb 7> [local count: 1014686024]:
  # ivtmp.17_28 = PHI <ivtmp.17_47(5), _61(4)>
  _37 = (void *) ivtmp.17_28;
  vect__8.8_46 = MEM <vector(2) int> [(int *)_37];
  vect__4.9_45 = VEC_PERM_EXPR <vect__8.8_46, vect__8.8_46, { 1, 0 }>;
  _43 = BIT_FIELD_REF <vect__8.8_46, 32, 0>;
  _44 = BIT_FIELD_REF <vect__8.8_46, 32, 32>;
  if (_43 > _44)
    goto <bb 5>; [94.50%]
  else
    goto <bb 6>; [5.50%]

  <bb 8> [local count: 14196616]:

  reply	other threads:[~2022-04-25  3:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 14:25 [Bug c/105363] New: " mtzguido at gmail dot com
2022-04-25  3:16 ` crazylht at gmail dot com [this message]
2022-04-25  3:37 ` [Bug c/105363] " crazylht at gmail dot com
2022-04-25  7:21 ` [Bug tree-optimization/105363] " rguenth at gcc dot gnu.org

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-105363-4-KYoH4XVw9o@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).