public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bin.Cheng" <amker.cheng@gmail.com>
To: Jeff Law <law@redhat.com>
Cc: Bin Cheng <bin.cheng@arm.com>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH GCC]Improve loop bound info by simplifying conversions in iv base
Date: Fri, 14 Aug 2015 07:29:00 -0000	[thread overview]
Message-ID: <CAHFci28bwxDZgGz8x4AMkYBGwL3D06OnhuCnGBsHZ887zqt01Q@mail.gmail.com> (raw)
In-Reply-To: <55CD15BD.20607@redhat.com>

On Fri, Aug 14, 2015 at 6:10 AM, Jeff Law <law@redhat.com> wrote:
> On 07/28/2015 03:38 AM, 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  <bin.cheng@arm.com>
>>
>>         * 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  <bin.cheng@arm.com>
>>
>>         * 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.
>
> I have the same concerns about these tests...  Which makes me really think I
> must be mis-understanding something in the debugging output.

This patch tries to simplify SCEV base with the help of loop's initial
conditions.  The previous patch can only handle simplified SCEV base
when analyzing loop's bound information.  It's independent to the
previous one.  Actually it can be viewed as an irrelevant patch even
the previous one is proven wrong.  Of course, I need to change test
case in that way.

Thanks,
bin
>
> jeff
>

  reply	other threads:[~2015-08-14  3:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 10:14 Bin Cheng
2015-08-13  8:58 ` Bin.Cheng
2015-08-13 22:16 ` Jeff Law
2015-08-14  7:29   ` Bin.Cheng [this message]
2015-08-14  8:32 ` Richard Biener
2015-08-20  8:24   ` Bin.Cheng
2015-08-20 11:24     ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHFci28bwxDZgGz8x4AMkYBGwL3D06OnhuCnGBsHZ887zqt01Q@mail.gmail.com \
    --to=amker.cheng@gmail.com \
    --cc=bin.cheng@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).