From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B0A83858D1E; Sun, 31 Dec 2023 21:07:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B0A83858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704056827; bh=fKe+S7/Qiy1ZmyP6AGBkjwglCu+l2Pt016WuZYuRLbw=; h=From:To:Subject:Date:From; b=q2kGrLXros2tDlP3pJCnUVrY3Od8gJQ0Eluh5dRJIG5npPBvI4FSC4o0qrnKf1RSh fql2aS42zPUdGfJNl1Z2BmI5IqljXXx7bSfpuVXqiN/68OKuSSbBuW/zAdjvShjZGA 7RU8ZlOjM9ykGdglJxvyXlle9kLpHiS4pKINzLD4= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113186] New: [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool Date: Sun, 31 Dec 2023 21:07:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: UNCONFIRMED 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D113186 Bug ID: 113186 Summary: [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` bool f(bool a, bool c) { bool b =3D (a^c); bool d =3D (a^!c); return b & d; } ``` This should optimize to 0 but does not since GCC 13. With the C++ front-end= , I suspect since r13-1779-g375668e0508fbe . With the C front-end, it started on the trunk. For C have in forwprop1: b_7 =3D a_5(D) ^ c_6(D); _11 =3D a_5(D) ^ c_6(D); _12 =3D a_5(D) =3D=3D c_6(D); _13 =3D b_7 & _12; For C++ we have (at -O1): b_7 =3D a_5(D) !=3D c_6(D); _1 =3D ~c_6(D); d_8 =3D _1 !=3D a_5(D); _11 =3D b_7 & d_8; For C++ at -O2 in forwprop2, we have similar as what with the C front-end.=