From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10625 invoked by alias); 25 Jul 2014 14:04:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10600 invoked by uid 89); 25 Jul 2014 14:04:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qa0-f51.google.com Received: from mail-qa0-f51.google.com (HELO mail-qa0-f51.google.com) (209.85.216.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 25 Jul 2014 14:03:57 +0000 Received: by mail-qa0-f51.google.com with SMTP id k15so4498111qaq.24 for ; Fri, 25 Jul 2014 07:03:55 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.224.43.77 with SMTP id v13mr27300158qae.34.1406297035240; Fri, 25 Jul 2014 07:03:55 -0700 (PDT) Received: by 10.140.49.111 with HTTP; Fri, 25 Jul 2014 07:03:55 -0700 (PDT) In-Reply-To: References: <002e01cfa19e$ac13fed0$043bfc70$@arm.com> Date: Fri, 25 Jul 2014 14:42:00 -0000 Message-ID: Subject: Re: [PATCH 2/3]Improve induction variable elimination From: "Bin.Cheng" To: Richard Biener Cc: Bin Cheng , GCC Patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg01734.txt.bz2 On Fri, Jul 25, 2014 at 1:35 PM, Richard Biener wrote: > On Thu, Jul 17, 2014 at 11:08 AM, Bin Cheng wrote: >> Hi, >> As quoted from the function difference_cannot_overflow_p, >> >> /* TODO: deeper inspection may be necessary to prove the equality. */ >> switch (code) >> { >> case PLUS_EXPR: >> return expr_equal_p (e1, offset) || expr_equal_p (e2, offset); >> case POINTER_PLUS_EXPR: >> return expr_equal_p (e2, offset); >> >> default: >> return false; >> } >> >> The overflow check can be improved by using deeper inspection to prove the >> equality. This patch deals with that by making below two improvements: >> a) Handles constant cases. >> b) Uses affine expansion as deeper inspection to check the equality. >> >> As a result, functions strip_wrap_conserving_type_conversions and >> expr_equal_p can be removed now. A test case is also added to illustrate iv >> elimination opportunity captured by this patch. >> >> Thanks, >> bin > > You add special casing for constants but I don't see any testcases for that. > Specifically > > + /* No overflow if offset is zero. */ > + if (offset == integer_zero_node) > return true; > > is a bogus check (use integer_zerop). Apart from the special-casing of Will be changed. > constants the patch looks good to me. > Ah, Now I can see that handling of constants (here the zero offset case) is to make the 3rd patch to work. I should include this part of code in the 3rd patch. Also I will try to reduce testcase for other non-zero constant scenarios Thanks, bin