From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4A89F3858D20; Wed, 21 Feb 2024 00:03:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A89F3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708473792; bh=6kW9CF8wQpnlFmfiWefNr3Yw8qSFKnYKO84j0Fl6Kf8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R/EencC91rk/WFNgC5OjOTyWsDHD3jPLkeRUe4mZ7q9BfrsOwtZTgDBpAcR9K4nzb vnXWp7s83lzBueQNTER+aZMm/fweXkSoyCpz2/wUFoKgg2oJt86XBqQ2g6fHcC+7os 0+WK4yB/qvUQgOIqcJ05GJm4q+Tz9iTRvDaHOBOs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114009] [11/12/13/14 Regression] Missed optimization: (!a) * a => 0 when a=(a/2)*2 Date: Wed, 21 Feb 2024 00:03:12 +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: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed 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=3D114009 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-02-21 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski --- Confirmed. What is happening is: `(a/2)*2 =3D=3D 0` gets optimized to `((unsigned)a) + 1 <=3D 2` and then we= don't handle: `((unsigned)a) + 1 <=3D 2 ? (a/2) : 0` which is just 0. as a has the range = of [-1,1] for the truth side and divide that by 2 is always 0.=