From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 49B98385CC8E; Mon, 18 Sep 2023 16:13:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49B98385CC8E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695053623; bh=7r4lVxmH9GS09TF4ec9ukM+NOl/T3Hv/l19egf80lOg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Q6Dyf6Gxzq71E2I0NEbGdPzjK2uzIcGkpHVHcRQ6kWjiH+9o//FxuzD1x1fMabeBD DRC2V0CtnsBq6g3LiHq1MufQfh5ci4dcdU/JtOc23a7VZhpNXpx0Xps4ichMo/VxjB 7GdSqcfqEYqypgqdEsEBUGYUpoWw2IW/LRKEoyQc= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111431] a & (a == 0) is not optimized to 0 Date: Mon, 18 Sep 2023 16:13:42 +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, patch, xfail X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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=3D111431 --- Comment #7 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:0fb828af75732d39c644fd145c29d41ca14b8cb1 commit r14-4105-g0fb828af75732d39c644fd145c29d41ca14b8cb1 Author: Andrew Pinski Date: Sat Sep 16 03:27:26 2023 +0000 MATCH: Add simplifications of `(a =3D=3D CST) & a` `(a =3D=3D CST) & a` can be either simplified to simplying `a =3D=3D CS= T` or 0 depending on the first bit of the CST. This is an extension of the already pattern of `X & !X` and allows us to remove the 2 xfails on gcc.dg/binop-notand1a.c and gcc.dg/binop-notand4a.c. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/111431 gcc/ChangeLog: * match.pd (`(a =3D=3D CST) & a`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/binop-notand1a.c: Remove xfail. * gcc.dg/binop-notand4a.c: Likewise. * gcc.c-torture/execute/pr111431-1.c: New test. * gcc.dg/binop-andeq1.c: New test. * gcc.dg/binop-andeq2.c: New test. * gcc.dg/binop-notand7.c: New test. * gcc.dg/binop-notand7a.c: New test.=