From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 42E333848039; Mon, 8 Mar 2021 08:47:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42E333848039 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99415] s115 benchmark of TSVC is vectorized by icc and not by gcc Date: Mon, 08 Mar 2021 08:47:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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: component bug_status everconfirmed blocked cf_reconfirmed_on keywords 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, 08 Mar 2021 08:47:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99415 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |tree-optimization Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Blocks| |53947 Last reconfirmed| |2021-03-08 Keywords| |missed-optimization --- Comment #1 from Richard Biener --- The benchmark is written badly to confuse our loop header copying it seems.= =20 Writing for (int j =3D 0; j < LEN_2D-1; j++) { for (int i =3D j+1; i < LEN_2D; i++) { a[i] -=3D aa[j][i] * a[j]; } } fixes the vectorizing. Possibly a mistake users do, so probably worth investigating further. Not sure how to most easily address this - we'd like to peel the last iteration of the outer loop, noting it does nothing. Maybe loop-splitting can figure this out? Alternatively loop header copying should just do its job... Hmm, actually loop-header copying does do its job but then there's jump threading messing this up again (the loop header check is redundant for all but the last iteration of the outer loop). So -fno-tree-dominator-opts fixes this as well. And for some reason ch_vect thinks the loops are all do-while loops. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations=