[PATCH] D150043: [InferAddressSpaces] Handle vector of pointers type & Support intrinsic masked gather/scatter

CaprYang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 06:23:17 PDT 2023


CaprYang added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:289
+
+static bool hasSameElementOfPtrOrVecPtrs(Type *Ty1, Type *Ty2) {
+  assert(isPtrOrVecOfPtrsType(Ty1) && isPtrOrVecOfPtrsType(Ty2));
----------------
arsenm wrote:
> arsenm wrote:
> > Ditto, only opaque pointers matter now
> You don't need to bother using getWithSamePointeeType. You can use Type::getWithNewType
Does it mean this? do't check non-opaque types.

```
static Type *getPtrOrVecOfPtrsWithNewAS(Type *Ty, unsigned NewAddrSpace) {
  assert(Ty->isPtrOrPtrVectorTy());
  PointerType *NPT = PointerType::get(Ty->getContext(), NewAddrSpace);
  return Ty->getWithNewType(NPT);
}
```


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

https://reviews.llvm.org/D150043



More information about the cfe-commits mailing list