From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B72163858C41; Thu, 26 Oct 2023 05:16:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B72163858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698297381; bh=Bo/+d4L7qNFAz9fNo0bz5+hhyGScG7VDMe8Hk0+zduw=; h=From:To:Subject:Date:From; b=tQD2otdVBxjv/uykbqwDG1bMWpz+jbDCAiXzuMt6fgEzrYX/iA+rV9YekUxPqBaab e3VLA3L1xQEsbjcf4BdZWT5ZML43vrTkz0OU5vfifRrl1q+j462XEQklN6g1cVAZUh QXrb1nH2rQo1aqyUKRZbvYQGgNfwDuhp49cv2zG4= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112096] New: `(a || b) ? a : b` should be simplified to a Date: Thu, 26 Oct 2023 05:16:21 +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: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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_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=3D112096 Bug ID: 112096 Summary: `(a || b) ? a : b` should be simplified to a Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int t0(int x, int y) { _Bool t =3D x =3D=3D 0 && y =3D=3D 0; if (t) return x; return y; } // y int t0_(int x, int y) { _Bool t =3D x =3D=3D 0 && y =3D=3D 0; if (t) return 0; return y; } // y int t1(int x, int y) { _Bool t =3D x || y; if (t) return x; return y; } // x int t1_(int x, int y) { _Bool t =3D x || y; if (t) return x; return 0; } // x ``` These should be simplified as the comment says All 4 of these are caught by LLVM.=