Richard Biener <rguent...@suse.de> writes: > On Thu, 6 Jun 2019, Jan Hubicka wrote: > >> > > This is more of an accident and there are cases where we do not trip >> > > across >> > > this -1 and we disambiguate array accesses that seems unsafe to me. >> > > >> > > With my change aliasing_component_refs_p finds the match of the >> > > array types (type_same_for_tbaa_p returns 1 with non-LTO becuase they >> > > have same canonical type) and disambiguates based on disjoint access >> > > ranges. >> > > >> > > I have thus went ahead and updated all uses of type_same_for_tbaa_p to >> > > special >> > > case arrays and reffer to this testcase (which seems odd and is only one >> > > in >> > > testsuite): We can still do useful disambiguation if the array is not >> > > toplevel >> > > reference or we know that the memory object is not bigger. This is >> > > tested by a >> > > testcase I added and is quite frequent in real world code. >> > > >> > > I also added check to give up on VLAs since I can not convicne myself >> > > that >> > > this is safe: I think early inlining VLAs and streaming them may lead to >> > > same VLA type have two different sizes at a time enabling it to partially >> > > overlap. >> > >> > OK - sorry for the delay. The array stuff gets a bit ugly so >> > we eventually want to do sth about that ... >> >> Thanks, no prob with the delay - I apprechiate we could discuss these >> things carefully as they are by no means obvious :) >> >> I agree that the way overlapping arrays support is done current is ugly >> and seems incomplete. I hope to clean it up now and craft more >> testcases. It seems bit odd decision to suport the partial overlaps as >> done by alias-2.c. I wonder how important it is in practice. > > Probably not very, likely appears in the context of VLAs or > multi-dimensional arrays. IIRC at some point I tried to > understand what the C standard says here but I don't remember > the outcome ;) Then there's also ARRAY_RANGE_REF ...
Dropping support for that would also allow cheaper runtime alias checks in the vectoriser for some cases, via the DDR_COULD_BE_INDEPENDENT_P stuff. Richard