This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fix PR46029: reimplement if conversion of loads and stores
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Alan Lawrence <alan dot lawrence at arm dot com>,Sebastian Pop <sebpop at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>,Abe Skolnik <a dot skolnik at samsung dot com>,"gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 26 Jun 2015 16:57:19 +0200
- Subject: Re: fix PR46029: reimplement if conversion of loads and stores
- Authentication-results: sourceware.org; auth=none
- References: <20150612205047 dot GA27819 at cc00 dot spa dot sarc dot sas> <55883757 dot 8070105 at arm dot com> <558AE47E dot 7050408 at redhat dot com> <CAFiYyc3zhrwcXn2=PgJua4=k6XtJsan_WGAtvbw7fz7kSAkSRg at mail dot gmail dot com> <CAFk3UF9O9PK8+ctcAB49sMduW7wDmM4R4=TgdYiFxS5pBH6V4w at mail dot gmail dot com> <558D43C2 dot 5000201 at arm dot com>
On June 26, 2015 2:21:22 PM GMT+02:00, Alan Lawrence <alan.lawrence@arm.com> wrote:
>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?
Another possibility is to not share them and make sure to insert clobbers for them when they become dead so later stack slot sharing can merge them again.
Richard.
>>> [...]
>>> 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