From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E640D3858031; Tue, 16 Nov 2021 02:15:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E640D3858031 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/29333] Jump threading getting in the way of PHI-OPT Date: Tue, 16 Nov 2021 02:15:26 +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: 4.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.0 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, 16 Nov 2021 02:15:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D29333 --- Comment #10 from Andrew Pinski --- (In reply to rsandifo@gcc.gnu.org from comment #8) > This may be worth filing as another PR (let me know if you > think I should), but another case of VRP stymieing phiopt is: >=20 > void bar (int); > void > foo (int a, int b) > { > if (!b) > bar (1); > else > { > int c; > if (a) > c =3D a; > else > c =3D 0; > if (c =3D=3D b) > bar (2); > } > } This was testcase was fixed on trunk by a combo of patches to tree-ssa-phio= pt.c and match.pd (r12-2041, r12-2040, r12-2039, and r12-1152 [there might have = been a few more required which I missed]) which allows early phiopt to change if= (a) c =3D a else c =3D 0; to just c =3D a.=