From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 35F113858D3C; Wed, 24 May 2023 22:16:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35F113858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684966588; bh=oEc/vbrjWMLU7/k0jhFGiDj/GPnkxC9LIcmApGiaSIk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gJIJWqzX+yU1WECF/NApHS2/JNZJVa41PO6ISuuzzjb/wCVqksl2Re3tyYcB8kPMW e//9YdBc6MQYCrX23yjOUQzP4JK16djZkwDkPAev+4abmn/SQo/Zc+8K/J11E00Tlm AdE6TRmjtJivzHYApHaJaSZVmkhzRabhMzhiYl5g= 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:16:28 +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: short_desc 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 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|`(a > 1) ? 0 : (a =3D=3D 1)` is |`(a > 1) ? 0 : (a =3D= =3D 1)` is |not optimized when spelled |not optimized when spelled |out |out at -O2+ --- Comment #1 from Andrew Pinski --- I should say this at -O2. part of the reason is VRP changes `a =3D=3D 1` to be `(bool)a` and then phi= opt comes along and decides to factor out the conversion (phiopt did that even before my recent changes). at -O1, it is actually optimized during reassoc1 (because the above is not done) since GCC 7.=