From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 47B67386EC42; Tue, 12 Jan 2021 10:33:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47B67386EC42 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95034] Failure to convert xor pattern (made out of or+and) to xor Date: Tue, 12 Jan 2021 10:33:09 +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: 11.0 X-Bugzilla-Keywords: easyhack, missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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, 12 Jan 2021 10:33:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95034 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- For int combine (int a, int b) { return (a | b) & ~(a & b); } we do optimize it, for the ||s and &&s the problem is that it is split accr= oss multiple basic blocks, so match.pd is out of the picture, but on the other = side reassoc which can handle conditions split across multiple bbs will handle o= nly a single truth operation (so the && in this case) and so we'd need to look through the |s from there manually. Ah, an option could be to add some truth_{and,ior,*} rules in match.pd, lim= ited to GENERIC probably, as it won't trigger afterwards. But of course that would handle only the above testcase and not e.g. bool t1 =3D a || b; bool t2 =3D !(a && b); return t1 && t2; etc. Richard, any ideas?=