From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DC1633858D35; Tue, 31 Aug 2021 01:35:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC1633858D35 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102139] [11/12 Regression] -O3 miscompile due to slp-vectorize on strict align target Date: Tue, 31 Aug 2021 01:35:47 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Tue, 31 Aug 2021 01:35:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102139 --- Comment #4 from Andrew Pinski --- (In reply to Andrew Pinski from comment #3) > There is no PHI for a for FRE to merge even. And there is no alignment > information on the pointers assignments either. The only thing FRE does for this testcase which SLP might make a huge mista= ke on is prop a_11(D) into the MEM. From: # i_24 =3D PHI <0(2)> _22 =3D i_24 * 8; _25 =3D a_11(D) + _22; MEM[(vector(4) short unsigned int *)_25] =3D { 0, 0, 0, 0 }; Into: MEM[(vector(4) short unsigned int *)a_11(D)] =3D { 0, 0, 0, 0 }; But SLP seems like does not take into account the two sides of the branches= are unrelated and still uses the alignment of the first for the second. /app/example.cpp:6:10: note: recording new base alignment for a_11(D) alignment: 2 misalignment: 0 based on: *a_11(D) =3D 0; /app/example.cpp:6:10: note: recording new base alignment for a_11(D) alignment: 8 misalignment: 0 based on: MEM[(vector(4) short unsigned int *)a_11(D)] =3D { 0, 0, 0,= 0 };=