From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5501D3858410; Fri, 12 Nov 2021 15:23:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5501D3858410 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 since r12-3876-g4a960d548b7d7d94 Date: Fri, 12 Nov 2021 15:23:41 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: aldyh at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to 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: Fri, 12 Nov 2021 15:23:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103202 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |aldyh at gcc dot gn= u.org --- Comment #8 from Aldy Hernandez --- The problem here is this thread: [5] Registering jump thread: (13, 11) incoming edge; (11, 10) nocopy;=20 BB11 has this: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 11 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Imports: n_42=20=20 Exports: n_42=20=20 Relational : (n_45 < n_42) [local count: 118111614]: # np_43 =3D PHI # n_42 =3D PHI # m_31 =3D PHI <0(13), m_16(4)> n_45 =3D n_42 + -1; if (n_42 !=3D 0) goto ; [89.00%] else goto ; [11.00%] Because of the ordering of the import bitmap, we solve m_31 first to 0. Th= en, when we solve n_42, we think we can use the m_31 in the cache, but the orde= ring is wrong. PHIs must always be done first. We went through a similar exercise to get relationals right and somehow missed this.=