From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C6D13858D33; Sat, 16 Sep 2023 02:53:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C6D13858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694832827; bh=NGXC42/dzoAvJ4LbGfQE5u0X8SPg6aIucSm7BAzS1oI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pRVuXV075hPJuSWG4hiXOFe1tkvr9yFTh7LGOpnnY4dB/K6py6hl95SHBwR/YzG4g GJo281RfM4/YmbL//82nXgAGnodOk3PDU0hOUaKICQ4Y8k26jyz2jHt2bTEYtjZgGa xF7VxQ30kysxWyjlrmYcuDr202vFTIlyLD8mmMmY= From: "pinskia 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: Sat, 16 Sep 2023 02:53:47 +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, xfail X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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 #2 from Andrew Pinski --- The pattern should be: (simplify (bit_and:c (convert@2 (eq @0 INTEGER_CST@1)) (convert? @0)) (if ((wi::to_wide (@1) & 1) !=3D 0) @2 { build_zero_cst (type); })) Since 0/1 of the eq, the convert on the @0 inside the bit_and does not matt= er.=