From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A97023858D35; Sat, 5 Aug 2023 05:09:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A97023858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691212145; bh=5NyCJ7VxsVyLo0w4gyKwW3b9TELE1nM9+0Cyw52Ne7I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l83rsmWxh96qybEfQrIUozRvc6Llfgak9ayLF2RV7B0A6/d0fsAQqRvg3CGUZJlD0 GTPiDshR+0y/wIDJCJuq8aLIgieL3zxzzFe4RoqSCWNJwPrQLv4yE+xPyLOcpDG5yJ 5WYu45U8IgZ8Nk1jpV6PTabyJqUgNAyMpdMtA78w= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/96695] Failure to optimize combination of pointer comparison to nullptr and another pointer Date: Sat, 05 Aug 2023 05:09:05 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status 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=3D96695 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #3 from Andrew Pinski --- We handle: bool f2(unsigned x, unsigned y) { return (x =3D=3D 0) && (x > y); } via: /* x > y && x !=3D XXX_MIN --> x > y x > y && x =3D=3D XXX_MIN --> false . */ min_value is defined as: (match min_value INTEGER_CST (if (INTEGRAL_TYPE_P (type) && wi::eq_p (wi::to_wide (t), wi::min_value (type))))) I suspect we could add POINTER_TYPE_P there and it will work.=