Re: Lingering tbaa in anti_dependence?
Richard Guenther <richard.guenther <at> gmail.com>
2012-01-02 11:36:53 GMT
On Fri, Dec 30, 2011 at 6:53 PM, Jakub Jelinek <jakub <at> redhat.com> wrote:
> On Thu, Dec 29, 2011 at 04:24:31PM +0000, Richard Sandiford wrote:
>> AIUI, the outcome of PR38964 was that we can't use TBAA for testing an
>> anti_dependence between a load X and store Y because Y might be defining
>> a new object in the same space as the object that was being read by X.
>> But it looks like we still use component-based disambiguation
>> (nonoverlapping_component_refs_p) in this case. Is it true that
>> that's also a problem? E.g. for:
>>
>> struct s { int f; float g; };
>> struct t { int header; struct s s; };
>>
>> float foo (struct t *newt, struct s *olds, int x, int y)
>> {
>> float ret = olds[x * y].g;
>> newt->header = 0;
>> newt->s.f = 1;
>> newt->s.g = 1.0;
>> return ret;
>> }
>>
>> we can (and on ARM Cortex A8, do) move the store to newt->s.f above
>> the load from olds[...].g. If we view the assignment to newt
>> as defining a new object in the same space as the now-defunct olds,
>> and if x * y happens to be zero, then the accesses might well be
>> to the same address.
>
> You would need a placement new in between the read from olds[x * y].g
> and newt->* stores, without that it is definitely valid to move it
> ahead of the store.
(Continue reading)