ASDenysPetrov added a comment.

In D104285#2949772 <https://reviews.llvm.org/D104285#2949772>, @aaron.ballman 
wrote:

> I don't think that compilers will create a disjointed multidimensional array, 
> as that would waste space at runtime. However, I do think that *optimizers* 
> are getting much smarter about UB situations, saying "that can't happen", and 
> basing decisions on it. For example, this touches on pointer provenance which 
> is an open area of discussion in LLVM that's still being hammered out (it 
> also relates to the C `restrict` keyword). In a provenance world, the pointer 
> has more information than just its address; it also knows from where the 
> pointer was derived, so you can tell (in the backend) that `&ptr1[5]` and 
> `&ptr2[0]` point to *different* objects even if the pointer values are 
> identical. So while the runtime layout of the array object may *allow* for 
> these sort of type shenanigans with the most obvious implementation 
> strategies for multidimensional arrays, the programming language's object 
> model does not allow for them and optimizers may do unexpected things.

This is really significant obstructions. As what I see the only thing left for 
us is to wait until the Standard transforms this //shenanigans// into legal 
operations and becomes closer to developers.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104285/new/

https://reviews.llvm.org/D104285

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to