From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C85543857835; Wed, 11 Jan 2023 14:24:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C85543857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673447085; bh=Rr8vQDhjzpNuLLFSCQe+ou3GnX9x1IV7AMSf0DWh1cI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aAxZVGrzP5WaTE8t/uM9Wso3p9AIDhUgrhDt3Vy20VqDeReZU3fWK8CS54Zc6QGH9 EpNUggmqO5aKPPaqjV4fEy8E5Yvmj+vW3Mr6M/pC3PXhw2xxV2FddmviOR25wOyvPU FkAgcmXrX7jnO+CHnKVCw93VmvjnQATBZpsfKlfs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108370] gcc doesn't merge bitwise-AND if an explicit comparison against 0 is given Date: Wed, 11 Jan 2023 14:24:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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=3D108370 --- Comment #2 from Richard Biener --- ifcombine seems to assume that D.1987_7 =3D op0 & 1; if (D.1987_7 !=3D 0) is canonical but we see _9 =3D (_Bool) _6; if (_9 !=3D 0) instead. That's already the form introduced by inlining from _Bool bio_flagged (struct bio * bio, unsigned int bit) { short unsigned int _1; unsigned int _2; unsigned int _3; unsigned int _4; _Bool _8; : _1 =3D bio_6(D)->bi_flags; _2 =3D (unsigned int) _1; _3 =3D _2 >> bit_7(D); _4 =3D _3 & 1; _8 =3D _4 !=3D 0; return _8; and : _1 =3D bio_flagged (bio_7(D), 0); if (_1 !=3D 0) goto ; [INV] else goto ; [INV]=