From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2121B3858D3C; Wed, 24 May 2023 22:21:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2121B3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684966898; bh=0I4O7NzF2I8jDgbLMFRbJIsNHsy3i1tanjbo2m8ONsI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=afGl3rmft09jRPKvcce9SDif6wjnSjqqbWVAxOL5tuXZMtZLMbF06UgU6albX1aeE vM2HV68mnAdMS1+pWeYBdO7BD/XHr/VVJRUbbAca/bQ4HTMcmA4qq5/8szQl3widOl mvw8/fsVlb6Y08nM9Y1JJf+iudhrYOoaYcoUs6jA= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109959] `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out at -O2+ Date: Wed, 24 May 2023 22:21:38 +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: 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: 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=3D109959 --- Comment #3 from Andrew Pinski --- here is another related testcase but this was the exactly reduced one from bitmap_single_bit_set_p : ``` _Bool f(unsigned a, int t) { void g(void); if (t) return 0; g(); if (a > 1) return 0; return a =3D=3D 1; } ``` this should be optimized down to: ``` _Bool f(unsigned a, int t) { void g(void); if (t) return 0; g(); return a =3D=3D 1; } ```=