From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 45B183839C4E; Mon, 7 Jun 2021 10:20:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45B183839C4E From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100923] [9/10/11/12 Regression] wrong code at -O2 and above on x86_64-linux-gnu Date: Mon, 07 Jun 2021 10:20:58 +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: 12.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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: Mon, 07 Jun 2021 10:20:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100923 --- Comment #5 from Richard Biener --- The bug is that PTA computes : *j_15(D) =3D &l; # PT =3D null _2 =3D *j_15(D); # PT =3D null _3 =3D *_2; and VN (in)correctly value-numbers the later load from 'l' to _3, pulling the points-to info into the alias test. PTA does not generate a constraint for *j_15(D) =3D &l; where *null =3D &l is thrown away early and _2 =3D *j_15(D); _2 =3D *null as well. So _2 remains empty thus _3 as well. We thus enter the alias-oracle with a valueized ref that looks like __MEM (_3) via ao_ref_init_from_vn_reference which fails to consider availability here. Not sure why -fno-strict-aliasing "works", it looks like we fail to value-number the load from 'l' for some reason. It's going to be a bit awkward to fix, but maybe it's not too bad.=