[PATCH] D105321: [Bitcode][OpaquePtr] Remove usages of PointerType's getElementType()

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 2 14:37:41 PDT 2021


aeubanks added a comment.

In D105321#2855880 <https://reviews.llvm.org/D105321#2855880>, @zequanwu wrote:

> In D105321#2854815 <https://reviews.llvm.org/D105321#2854815>, @nikic wrote:
>
>> I don't really get how this is supposed to work. If opaque pointers are enabled, all PointerTypes (in the same address space) are going to be the same, so you can't create a meaningful map from PointerType to element type. The map will effectively store the last element type it has seen on any pointer.
>
> This is to be compatible with llvm bitcode file with opaque pointer disabled. Those files have pointers' pointee types encoded. So, we need the map to keep track of pointers' pointee types.

the issue is what nikic said, that if we ignore address spaces, there will only be one singleton PointerType. We can't map the same PointerType to multiple pointee types, that doesn't do anything.
Rather, we need to map each Value to a potential pointee type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105321



More information about the llvm-commits mailing list