From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 82C403858D33; Mon, 28 Aug 2023 22:52:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82C403858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693263129; bh=+KiPGchUJAmpeFUzmJ2cmc3bjKkpg0F8zICF6tnew7c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=in3agAZ5IokG71bbSU7RkWwDGiAdpROJ/a8SA9TupKPB+yRBHHyNmU+gr+oEI1EN+ t4oQYynm/piHZyz/pNDcUqt4lZZ4p6O2wlDEzJwWWCchF8wTGF4vrd4WoghYzdQ6uf dVKDivHKgyvYwf4zFw+40d2wh9BDIaxFVS8P3vVM= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107880] bool tautology missed optimisation Date: Mon, 28 Aug 2023 22:52: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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED 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: bug_status 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=3D107880 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #4 from Andrew Pinski --- With a patch I have for PR 95185 we get: ``` _1 =3D b_2(D) =3D=3D a_3(D); _10 =3D b_2(D) ^ a_3(D); _5 =3D _1 ^ _10; ``` Which is better than before. One more improvement would be: ``` bool a(bool x, bool y) { bool t =3D x =3D=3D y; return t ^ x; } ``` Into: ``` bool a0(bool x, bool y) { bool t =3D (x ^ y); return t ^ x ^1; // ~y } ``` So the 2 which are needed still: /* (a =3D=3D b) ^ a -> b^1 */ (simplify (bit_xor:c (eq:c zero_one_valued_p@0 zero_one_valued_p@1) @0) (bit_xor @1 { build_one_cst (type); }) /* (a =3D=3D b) ^ (a^b) -> b^(b^1) or (b^b)^1 or rather 1 */ (simplify (bit_xor:c (eq:c zero_one_valued_p@0 zero_one_valued_p@1) (bit_xor:c @0 @1= )) { build_one_cst (type); }) So mine.=