public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Marc Glisse <marc.glisse@inria.fr>
Cc: "Bin.Cheng" <amker.cheng@gmail.com>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH GCC][1/2]Feed bound computation to folder in loop split
Date: Wed, 26 Jul 2017 11:46:00 -0000	[thread overview]
Message-ID: <CAFiYyc2Rw4jkd1c6egiHPgMfkJzsstV68=6wrkOizAnDPnX4Dg@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc39o8eb_hxzqw9ZCAHaY5gY+xNWX00X+ME0tKRdjYRHgA@mail.gmail.com>

On Wed, Jul 26, 2017 at 9:48 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Tue, Jul 25, 2017 at 7:45 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
>> On Tue, 25 Jul 2017, Richard Biener wrote:
>>
>>>> I think we need Richard to say what the intent is for the valueization
>>>> function. It is used both to stop looking at defining stmt if the return
>>>> is
>>>> NULL, and to replace/optimize one SSA_NAME with another, but currently it
>>>> seems hard to prevent looking at the defining statement without
>>>> preventing
>>>> from looking at the SSA_NAME at all.
>>>
>>>
>>> Yeah, this semantic overloading is an issue.  For gimple_build we have
>>> nothing
>>> to "valueize" but we only use it to tell genmatch that it may not look at
>>> the
>>> SSA_NAME_DEF_STMT.
>>>
>>>> I guess we'll need a fix in genmatch...
>>>
>>>
>>> I'll have a look tomorrow.
>>
>>
>> My impression yesterday was that we could replace the current do_valueize
>> wrapper by 2 wrappers (without touching the valueize callbacks):
>> - may_check_def_stmt, which returns a bool corresponding to the current
>> do_valueize != NULL_TREE
>> - maybe_valueize, which tries to valueize, but if it gets a NULL_TREE, it
>> returns its argument unchanged.
>>
>> Not very confident about it though.
>
> Note I've been there in the past (twice I think) but always ran into existing
> latent issues.  So hopefully we've resolved those, I'm testing the following
> simplified variant of what I had back in time.
>
> It'll produce
>
>   switch (TREE_CODE (op0))
>     {
>     case SSA_NAME:
>       if (gimple *def_stmt = get_def (valueize, op0))
>         {
>           if (gassign *def = dyn_cast <gassign *> (def_stmt))
>             switch (gimple_assign_rhs_code (def))
>               {
>               case MINUS_EXPR:
>                 {
>                   tree o20 = gimple_assign_rhs1 (def);
>                   o20 = do_valueize (valueize, o20);
>                   tree o21 = gimple_assign_rhs2 (def);
>                   o21 = do_valueize (valueize, o21);
>                   if (op1 == o21 || (operand_equal_p (op1, o21, 0) &&
> types_match (op1, o21)))
>                     {
>
> which also indents less which is nice.
>
> Bootstrap/regtest running on x86_64-unknown-linux-gnu.

Now applied with

        * gcc/testsuite/gcc.dg/pr70920-2.c: Adjust for transform already
        happening in ccp1.
        * gcc/testsuite/gcc.dg/pr70920-4.c: Likewise.

that shows it's working (CCP is one of the passes eventually running
into this issue).

Richard.

> Richard.
>
> 2017-07-26  Richard Biener  <rguenther@suse.de>
>
>         * gimple-match-head.c (do_valueize): Return OP if valueize
>         returns NULL_TREE.
>         (get_def): New helper to get at the def stmt of a SSA name
>         if valueize allows.
>         * genmatch.c (dt_node::gen_kids_1): Use get_def instead of
>         do_valueize to get at the def stmt.
>         (dt_operand::gen_gimple_expr): Simplify do_valueize calls.
>
>
>> --
>> Marc Glisse

      parent reply	other threads:[~2017-07-26 11:46 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 13:07 Bin Cheng
2017-06-16 10:49 ` Richard Biener
2017-06-16 13:06   ` Bin.Cheng
2017-06-16 13:10     ` Richard Biener
2017-06-16 13:31       ` Bin.Cheng
2017-06-16 16:16         ` Richard Biener
2017-06-16 16:23           ` Bin.Cheng
2017-06-16 16:48             ` Marc Glisse
2017-06-16 16:58               ` Bin.Cheng
2017-06-16 17:04               ` Andrew Pinski
2017-07-24 11:45               ` Bin.Cheng
2017-07-24 12:16                 ` Marc Glisse
2017-07-24 13:49                   ` Bin.Cheng
2017-07-24 13:59                 ` Marc Glisse
2017-07-24 14:06                   ` Bin.Cheng
2017-07-24 14:31                     ` Marc Glisse
2017-07-24 14:37                       ` Bin.Cheng
2017-07-24 14:52                         ` Marc Glisse
2017-07-25 14:32                       ` Richard Biener
2017-07-25 17:45                         ` Marc Glisse
2017-07-26  7:48                           ` Richard Biener
2017-07-26  9:08                             ` Richard Sandiford
2017-07-26  9:38                               ` Marc Glisse
2017-07-26  9:45                                 ` Richard Sandiford
2017-07-26  9:57                                   ` Marc Glisse
2017-07-26 11:13                                     ` Richard Biener
2017-07-26 11:46                             ` Richard Biener [this message]

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='CAFiYyc2Rw4jkd1c6egiHPgMfkJzsstV68=6wrkOizAnDPnX4Dg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    /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).