From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25798 invoked by alias); 14 Mar 2012 15:46:56 -0000 Received: (qmail 25789 invoked by uid 22791); 14 Mar 2012 15:46:56 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Mar 2012 15:46:43 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/52589] New: VRP missed optimization Date: Wed, 14 Mar 2012 16:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-03/txt/msg01281.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589 Bug #: 52589 Summary: VRP missed optimization Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: jakub@gcc.gnu.org extern void link_error (void); void foo (unsigned int s) { if (s + 0x70000000 < 0xf0000000U) { if (s >= 0x80000000U && s < 0x90000000U) link_error (); } } void bar (unsigned int s) { if (s + 0x70000000 >= 0xf0000000U) { if (s < 0x80000000U || s >= 0x90000000U) link_error (); } } In the above testcase, bar is optimized fine (VRP adds an ASSERT_EXPR with range [0x80000000, 0x8fffffff] and optimizes away the test), but in foo it isn't - the range there is ~[0x80000000, 0x8ffffffff] and we don't handle the VR_ANTI_RANGE somewhere where we should. I've noticed this while working on PR52267 - the vrp65.c testcase that I'm bootstrapping there right now needs to have 4 tests commented out (well, replaced by checks of a few selected values from the range which VRP optimizes out properly).