From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 84E643858402; Tue, 24 Oct 2023 20:45:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84E643858402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698180351; bh=zcKWgVC3qnbfwU6WsWoicekZriCYvk3LusJ1tLvZ4CI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VR4yoRSIdHoUQglb3PlCNHgdWZqbbwvYObtnimN9Y2BmHDG9T7CxCZl+YiKKYiW4O Q0YB7QCzJ9hJIutW/9ufhualt8xJFFuvzXui4OxSJe6YRdgRtQdkXq3R9J1C/ee/I2 Dc6SKK/MUEM+AB/RW/TQ7/Q37lU8S9+LMt4SxQus= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/68131] missed optimization and warning for broken overflow check Date: Tue, 24 Oct 2023 20:45:50 +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: 5.1.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.0 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=3D68131 --- Comment #5 from Andrew Pinski --- (In reply to Marc Glisse from comment #3) > (In reply to Richard Biener from comment #2) > > We indeed do not have this optimization, only A + CST CMP CST to A CMP = CST' > > and related. Note that _9 might be negative so we also need range info > > for this. VRPs symbolic range stuff isn't good enough to simplify this. >=20 > If we want to simplify directly to false, I would expect a match.pd patte= rn > using tree_expr_nonnegative_p to work in this case (conversion from a > smaller unsigned). By the way, maybe tree_single_nonnegative_warnv_p could > try looking at get_range_info before forwarding to > gimple_stmt_nonnegative_warnv_p. Oh I filed PR 111959 (and will be submitting a patch later today) for that.=