public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Lawrence <alan.lawrence@arm.com>
To: Sebastian Pop <sebpop@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	 Jeff Law <law@redhat.com>, Abe Skolnik <a.skolnik@samsung.com>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: fix PR46029: reimplement if conversion of loads and stores
Date: Fri, 26 Jun 2015 12:35:00 -0000	[thread overview]
Message-ID: <558D43C2.5000201@arm.com> (raw)
In-Reply-To: <CAFk3UF9O9PK8+ctcAB49sMduW7wDmM4R4=TgdYiFxS5pBH6V4w@mail.gmail.com>

Sebastian Pop wrote:
> On Thu, Jun 25, 2015 at 4:43 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> when the new scheme triggers vectorization cannot succeed on the
>> result as we get
>>
>>   if (cond)
>>     *p = val;
>>
>> if-converted to
>>
>>   tem = cond ? p : &scratch;
>>   *tem = val;
> 
> That's correct.
> 
>> and
>>
>>    if (cond)
>>      val = *p;
>>
>> if-converted to
>>
>>   scatch = val;
>>   tem = cond ? p : &scratch;
>>   val = *tem;
> 
> The patch does this slightly differently:
> 
>    tem = cond ? p : &scratch;
>    val = cond ? *tem : val;
> 
> I think I like your version better as it has only one cond_expr.

Another slight concern...by reusing scratchpad's, are we at risk of creating 
lots of false dependencies here, that restrict instruction scheduling / other 
opts later?

>> [...]
>> and thus the store and loads appear as scather/gather ones to
>> the vectorizer (if-conversion could directly generate masked
>> load/stores of course and not use a scratch-pad at all in that case).

Thank you Richard for much better expressing what I was thinking here too :)

> Abe also suggested to continue optimizing the other way in cases
> where we know to write or load from the same location on all branches:
> 
> if (c)
>   A[i] = ...
> else
>   A[i] = ...

The store here really should be commoned, yes.

(Related but different?: BZ 56625.)


I might add, I find this code much easier to follow than the old (removed) code 
about data references, memrefs_read_unconditionally, and 
write_memrefs_written_at_least-once...

Thanks, Alan

  reply	other threads:[~2015-06-26 12:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 21:05 Abe Skolnik
2015-06-22 16:31 ` Alan Lawrence
2015-06-24 17:11   ` Jeff Law
2015-06-25  9:48     ` Richard Biener
2015-06-25 14:28       ` Sebastian Pop
2015-06-26 12:35         ` Alan Lawrence [this message]
2015-06-26 15:10           ` Richard Biener
2015-06-26 21:29             ` Jeff Law
2015-07-06 20:46       ` Jeff Law
2015-06-24 16:51 ` Ramana Radhakrishnan
2015-06-24 17:02   ` Jeff Law
     [not found] <001301d0ae99$0f015800$2d040800$@samsung.com>
     [not found] ` <682387955.453848.1435166632115.JavaMail.yahoo@mail.yahoo.com>
     [not found]   ` <680180205.479081.1435168382362.JavaMail.yahoo@mail.yahoo.com>
2015-06-30  9:36     ` Alan Lawrence
2015-07-07 21:23 Abe
2015-07-08  9:14 ` Alan Lawrence
2015-07-08 15:52   ` Abe
2015-07-08  9:56 ` Richard Biener
2015-07-08 16:27   ` Abe

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=558D43C2.5000201@arm.com \
    --to=alan.lawrence@arm.com \
    --cc=a.skolnik@samsung.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=richard.guenther@gmail.com \
    --cc=sebpop@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).