From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E66AF3858D33; Mon, 25 Apr 2022 03:16:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E66AF3858D33 From: "crazylht at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2022 03:16:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105363 Hongtao.liu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |crazylht at gmail dot com --- Comment #1 from Hongtao.liu --- 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 =3D 1; i < n; i++) { for (j =3D i-1; j >=3D 0 && a[j] > a[j+1]; j--) { int t =3D a[j+1]; a[j+1] =3D a[j]; a[j] =3D t; } } } dump: [local count: 958878294]: MEM [(int *)_37] =3D vect__4.9_45; ivtmp.17_47 =3D ivtmp.17_28 + 18446744073709551612; if (_11 !=3D ivtmp.17_47) goto ; [94.50%] else goto ; [5.50%] [local count: 114863531]: ivtmp.25_50 =3D ivtmp.25_9 + 1; ivtmp.28_52 =3D ivtmp.28_51 + 4; if (ivtmp.25_50 !=3D _59) goto ; [89.00%] else goto ; [11.00%] [local count: 1014686024]: # ivtmp.17_28 =3D PHI _37 =3D (void *) ivtmp.17_28; vect__8.8_46 =3D MEM [(int *)_37]; vect__4.9_45 =3D VEC_PERM_EXPR ; _43 =3D BIT_FIELD_REF ; _44 =3D BIT_FIELD_REF ; if (_43 > _44) goto ; [94.50%] else goto ; [5.50%] [local count: 14196616]:=