From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B27523858D20; Thu, 25 May 2023 02:51:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B27523858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684983092; bh=P3usrEDW0fALyUyEH3ukATDp6N48Gl8nT+l//cyeImg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T0wS1rW9Ec+xaVq/soS187TgXnAFczjmOpfqMv8CAIu/Wk9cP2B/uadQVSOtHG6yh DnWUARxRVCLb369HYtExTkIn/ZHVJZaTa1g/TAQ1lPO4QBBA1/FkM0dRempiXWkgGY DoA3sASaGVAFXEt+dOG/DWDyTY2kUOO1HVgGGrzU= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109960] [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` Date: Thu, 25 May 2023 02:51:32 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109960 --- Comment #4 from Andrew Pinski --- I happened to notice this because I am working on a match patch that transf= orm `a ? 1 : b` into `a | b`. In the case of stmt_can_terminate_bb_p, I noticed we had: [local count: 330920071]: _48 =3D MEM[(const struct gasm *)t_22(D)].D.129035.D.128905.D.128890.subc= ode; _49 =3D _48 & 2; if (_49 !=3D 0) goto ; [34.00%] else goto ; [66.00%] [local count: 218407246]: _50 =3D (bool) _48; [local count: 940291388]: # _13 =3D PHI <0(14), _50(32), _12(29), 0(11), 0(30), 1(2), 1(31), 0(25)> And the patch to match would do: [local count: 330920071]: _48 =3D MEM[(const struct gasm *)t_22(D)].D.129035.D.128905.D.128890.subc= ode; _49 =3D _48 & 2; _50 =3D (bool) _48; _127 =3D _49 !=3D 0; _44 =3D _50 | _127; [local count: 940291388]: # _13 =3D PHI <0(14), 0(25), _12(29), 0(11), 0(30), 1(2), _44(31)> Which is definitely better than before but I was like isn't that the same a= s: _49 =3D _48 & 3; _44 =3D _49 !=3D 0;=