From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B540C3858CDB; Sat, 23 Sep 2023 20:14:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B540C3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695500085; bh=ZM/py7DBCpAor19JmgdCX+A6/a0wjX/c4vrKDrfTfV8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gykeUFQcTdp9EPnXRSLVsYyd5+iO5AXri29wLq4cheSbmckaDsA6Ftt8qPJG0nXjI ZFlbcXAGYThlu4bu7KKEHsPbvmSPGOK9HlU8hS0VSwQ6dOB0t/ju38C0tYeMZKFcEH ZkbVldJZUJSMWmV0CSN86UHc32sl5mnBojuoNU+g= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111542] [11/12/13/14 Regression] (a==0)&(b==0) into `(a|b) == 0` optimization sometimes gets in the way of other optimizations Date: Sat, 23 Sep 2023 20:14:45 +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: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D111542 --- Comment #2 from Andrew Pinski --- Note IOR with !=3D 0 has the same issue. Full testcase: ``` _Bool f_and(int x,int y) { _Bool a =3D x =3D=3D 0; _Bool b =3D y =3D=3D 0; _Bool t =3D a & b; return t & !a; } _Bool f_or(int x,int y) { _Bool a =3D x !=3D 0; _Bool b =3D y !=3D 0; _Bool t =3D a | b; return t | !a; } ``` Match pattern: ``` (for bitop (bit_ior bit_and) cmp1 (eq ne ) cmp2 (ne eq ) (simplify (bitop:c (cmp1 @1 integer_zerop) (cmp2 (bit_ior:c @0 @1) integer_zerop)) { constant_boolean_node (bitop =3D=3D BIT_IOR_EXPR, type); })) ```=