From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF5BE3858C52; Sat, 30 Dec 2023 04:44:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF5BE3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703911444; bh=JPGs2SViw9WNZSTOfKVpZyHhp6HOY1Ond5GOZlW1MOw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OrBLSAgCahs95curvl+eE6WRRy6nX2OgEZEpqXPzU4w72out9+3M21CEsWbqvmIJB fBIP1anfeIMdw6M/RPZdK6xeH2AG5QtXP7kFd+6k5aQTjb0joNgtWTihqNgAYF3Fjr Typ/gNBr1MzokWcK9/Nlkhgfph0oKgPWr2zZBz5A= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113176] `(n / 4) ? n / 4 : 0` is not optimized to just `n /4` Date: Sat, 30 Dec 2023 04:44:04 +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=3D113176 --- Comment #1 from Andrew Pinski --- I should note the non-constant case is already handled: ``` int unopt(int n, int c) { if (n / c) return n / c; else return 0; } ``` It is just the constant case that has issues.=