rjmccall added a comment.

Sorry, let me be more precise.  The semantics of LLVM IR are that the element 
type of a pointer matters when doing specific operations on pointers: loads, 
stores, GEPs, calls, and so on.  Many of these operations have been at least 
partially updated — in some combination of the APIs for constructing them and 
the IR assembly listings — to require the "element" type to be given 
separately, but that's not really instrumental here.  What's instrumental is 
that, for almost all of these operations, the only thing that matters about the 
element type is its basic layout.  For example, it is perfectly legal in IR to 
load a `float` by loading any type that happens to be the same size as a 
`float` and then bitcasting that value to `float` — well, maybe it's not okay 
to load it as a `struct` with internal padding, because I think the padding 
bits might take on unspecified values, but anything else.  It is also legal in 
IR to do pointer arithmetic by using any combination of GEPs that happens to 
yield the right offset.  The only pointer operations where the specific details 
of the element type actually have semantic weight beyond their layout are calls.

This general lack of meaning is part of the reason we'd like to remove element 
types entirely.

I'm sorry, I'm not interested in taking the patch.


https://reviews.llvm.org/D49403



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

Reply via email to