On Wed, Mar 30, 2011 at 11:13 AM, Ira Rosen <ira.ro...@linaro.org> wrote:
> Hi,
>
> With this patch a data-ref is marked as unconditionally read or
> written also if its adjacent field is read or written unconditionally
> in the loop.
> My concern is that this is not safe enough, even though the fields
> have to be non-pointers and non-aggregates, and this optimization is
> applied only with -ftree-loop-if-convert-stores flag.
>
> Bootstrapped on powerpc64-suse-linux and tested on x86_64-suse-linux.
>
> OK for trunk?

The restrictions do not make too much sense to me.  For the C++
memory model we can't do speculative stores at all, but for the
rest I'd say just checking if the data-refs access the same object
is enough, thus, instead of same_data_refs (a, b) simply check
operand_equal_p (DR_BASE_ADDRESS (a), DR_BASE_ADDRESS (b), 0)
or operand_equal_p (get_base_address (DR_REF (a)), get_base_address
(DR_REF (b)), 0), whatever makes more sense (I always confuse what
the contents of the various DR fields are).

Thanks,
Richard.

> Thanks,
> Ira
>
>
> ChangeLog:
>
>         * tree-if-conv.c (memrefs_read_or_written_unconditionally): Return 
> true
>         if an adjacent field of the data-ref is accessed unconditionally.
>
> testsuite/ChangeLog:
>
>         * gcc.dg/vect/if-cvt-stores-vect-ifcvt-18.c: New test.
>         * gcc.dg/vect/vect.exp: Run if-cvt-stores-vect* tests with
>         -ftree-loop-if-convert-stores.
>

Reply via email to