From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 628913858D33; Fri, 3 Mar 2023 09:38:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 628913858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677836284; bh=H6oits7SBPwIFI9I1Lmq/g70HFGN0SebwLY3hQeHZoc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RUghI+ZD0J4wqFD31mx8vkKOETGxpNoRBIF2z79bLuWgbRKa1p7XoKYBAHUq1vHh6 fxaBWdTkKewSJEJT6n1NRZP/UmIKecqR2NBQa3U7K6noCfC1HsrettYy11pLJTnNB3 C+ZJRLajqIpnOiT0XktTiM9KFCXN/CCGl5OSbEFI= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109002] -O1 -ftree-pre -ftree-partial-pre results in stall value Date: Fri, 03 Mar 2023 09:38:02 +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: 13.0 X-Bugzilla-Keywords: 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: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109002 --- Comment #4 from Richard Biener --- When doing partial PRE we somehow lose the effect of g =3D 1; we also generate weird PHIs: pretmp_20 =3D h; pretmp_22 =3D g;=20 # prephitmp_21 =3D PHI # prephitmp_23 =3D PHI # prephitmp_24 =3D PHI # prephitmp_25 =3D PHI those are all unnecessary ... There's one old detail I never understood in partial ANTIC compute and that gets us weird expressions in here, which is that we do not PHI translate ANTIC_IN when computing PA_OUT. Fixing that fixes this bug. I have no idea how to create a testcase for the testsuite though besides verifying we're not inserting any PHI - but we also fail to partial-PRE the load of h here, likely because of the iteration order imposed by the infinite loop which is probably also key to the miscompilation. Anyway, I have a fix, but I'm not 100% sure it fixes the actual cause.=