From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5375 invoked by alias); 28 Oct 2015 12:59:28 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 5352 invoked by uid 48); 28 Oct 2015 12:59:24 -0000 From: "glisse 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: Wed, 28 Oct 2015 12:59:00 -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: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: glisse 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg02357.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68131 --- Comment #3 from Marc Glisse --- (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. If we want to simplify directly to false, I would expect a match.pd pattern 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. But the much simpler transformation: a+b b<0 does not require any VRP info and would let the next VRP pass finish the work.