From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 71BD0386F47D; Sat, 2 May 2020 02:18:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71BD0386F47D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588385925; bh=II/j004vHZLfcprxgrOXRD4Vxq+8ci27ICXGipFpBGA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CJ04F/u1KvKBEkXX98vyf8elvnN9/JI/spbjT1cUoOO4gEXSdnYU+oH5fOdxUnPx6 xBFzWo1J5YcxDfpidLdL9TGNdMuoIqLy9WglhBrukG5O2y4iEjy1THXuuinXrsGh8g Nd9e378zG6x3DBT3+aM4V8zp4S42XRZO/PRWff/0= From: "gabravier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94913] Failure to optimize not+cmp into overflow check Date: Sat, 02 May 2020 02:18:45 +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: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: gabravier at gmail dot com 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 02:18:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94913 --- Comment #1 from Gabriel Ravier --- The same thing happens for this code : bool f(unsigned x, unsigned y) { return (x - y - 1) >=3D x; } LLVM outputs this : f(unsigned int, unsigned int): cmp esi, edi setae al ret GCC outputs this : f(unsigned int, unsigned int): mov eax, edi sub eax, esi sub eax, 1 cmp eax, edi setnb al ret=