public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bin.Cheng" <amker.cheng@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>, Zdenek Dvorak <ook@ucw.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/3]Improve induction variable elimination
Date: Wed, 06 Aug 2014 02:32:00 -0000	[thread overview]
Message-ID: <CAHFci28kcwzNiNdoGsqrZTyZF3ywNB10XRTQP=DT2Owk6gBKYQ@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc1asoW_ZjA0DXJP_SfM7OC=c9W0dpj+V1zQ=TxfZseqqQ@mail.gmail.com>

On Fri, Jul 25, 2014 at 8:35 PM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Thu, Jul 17, 2014 at 11:08 AM, Bin Cheng <bin.cheng@arm.com> 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
> constants the patch looks good to me.

Hi Richard,
I modified the patch according to your comments by removing the
constant case.  Re-bootstrap and test on x86_64 and x86.  Is this
version OK?

Thanks,
bin

2014-08-06  Bin Cheng  <bin.cheng@arm.com>

    * tree-ssa-loop-ivopts.c (ivopts_data): New field name_expansion.
    (tree_ssa_iv_optimize_init): Initialize name_expansion.
    (tree_ssa_iv_optimize_finalize): Free name_expansion.
    (strip_wrap_conserving_type_conversions, expr_equal_p): Delete.
    (difference_cannot_overflow_p): New parameter.  Use affine
    expansion for equality check.
    (iv_elimination_compare_lt): Pass new argument.

gcc/testsuite/ChangeLog
2014-08-06  Bin Cheng  <bin.cheng@arm.com>

    * gcc.dg/tree-ssa/ivopts-lt-2.c: New test.

  parent reply	other threads:[~2014-08-06  2:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  9:09 Bin Cheng
2014-07-25 13:01 ` Richard Biener
2014-07-25 14:42   ` Bin.Cheng
2014-08-06  2:32   ` Bin.Cheng [this message]
2014-08-06  9:55     ` Bin.Cheng
2014-08-14  7:37   ` Bin.Cheng
2014-08-14 15:29     ` Sebastian Pop
2014-08-15  6:15       ` Bin.Cheng

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='CAHFci28kcwzNiNdoGsqrZTyZF3ywNB10XRTQP=DT2Owk6gBKYQ@mail.gmail.com' \
    --to=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ook@ucw.cz \
    --cc=richard.guenther@gmail.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).