From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91856 invoked by alias); 13 Aug 2015 08:27:10 -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 91846 invoked by uid 89); 13 Aug 2015 08:27:09 -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-oi0-f54.google.com Received: from mail-oi0-f54.google.com (HELO mail-oi0-f54.google.com) (209.85.218.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 13 Aug 2015 08:27:08 +0000 Received: by oip136 with SMTP id 136so22766963oip.1 for ; Thu, 13 Aug 2015 01:27:06 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.194.9 with SMTP id s9mr32931328oif.39.1439454426664; Thu, 13 Aug 2015 01:27:06 -0700 (PDT) Received: by 10.76.134.100 with HTTP; Thu, 13 Aug 2015 01:27:06 -0700 (PDT) In-Reply-To: <000801d0c919$220d0b70$66272250$@arm.com> References: <000801d0c919$220d0b70$66272250$@arm.com> Date: Thu, 13 Aug 2015 08:58:00 -0000 Message-ID: Subject: Re: [PATCH GCC]Improve loop bound info by simplifying conversions in iv base From: "Bin.Cheng" To: Bin Cheng Cc: gcc-patches List Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00681.txt.bz2 Ping. Thanks, bin On Tue, Jul 28, 2015 at 5:38 PM, Bin Cheng wrote: > Hi, > For now, SCEV may compute iv base in the form of "(signed T)((unsigned > T)base + step))". This complicates other optimizations/analysis depending > on SCEV because it's hard to dive into type conversions. For many cases, > such type conversions can be simplified with additional range information > implied by loop initial conditions. This patch does such simplification. > With simplified iv base, loop niter analysis can compute more accurate bound > information since sensible value range can be derived for "base+step". For > example, accurate loop bound&may_be_zero information is computed for cases > added by this patch. > The code is actually borrowed from loop_exits_before_overflow. Moreover, > with simplified iv base, the second case handled in that function now > becomes the first case. I didn't remove that part of code because it may(?) > still be visited in scev analysis itself and simple_iv isn't an interface > for that. > > Is it OK? > > Thanks, > bin > > 2015-07-28 Bin Cheng > > * tree-ssa-loop-niter.c (tree_simplify_using_condition): Export > the interface. > * tree-ssa-loop-niter.h (tree_simplify_using_condition): Declare. > * tree-scalar-evolution.c (simple_iv): Simplify type conversions > in iv base using loop initial conditions. > > gcc/testsuite/ChangeLog > 2015-07-28 Bin Cheng > > * gcc.dg/tree-ssa/loop-bound-2.c: New test. > * gcc.dg/tree-ssa/loop-bound-4.c: New test. > * gcc.dg/tree-ssa/loop-bound-6.c: New test.