From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 025CE3858D3C; Sun, 27 Nov 2022 18:59:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 025CE3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669575585; bh=RxnY3j51qBZ1TNUYigye72XOFOBmhRnq66DU6Tf2AJo=; h=From:To:Subject:Date:From; b=qdJsUFxFzN3lhhNDSJmraOLjQufdXP1fmK86wZ52LwTLCveGkZkehG2hQVBZEjFdE 1QbbebvrupYmIsMW1S3O0ahl9DuyGUTUim00+OnVDhs/cAsNvLZjMuMINoVXtCXxjB Elbf/+xzsLmEaw1lwWGHh+NGFN7Mq6S4T4gdHSi4= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107887] New: (bool0 > bool1) | bool1 is not optimized to bool0 | bool1 Date: Sun, 27 Nov 2022 18:59:44 +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: 13.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: 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=3D107887 Bug ID: 107887 Summary: (bool0 > bool1) | bool1 is not optimized to bool0 | bool1 Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` _Bool max(_Bool aa, _Bool bb) { bool t =3D aa > bb; return t | bb; } ``` This should be optimized to just `return aa | bb;` I accidently found this while working on PR 101805 . The original testcase which I found it: ``` int ii(_Bool aa, _Bool bb) { int c; int a =3D aa; int b =3D bb; if (a > b) c =3D a; else c =3D b; if (c) return 100; return c; } ```=