[PATCH] D150043: [InferAddressSpaces] Handle vector of pointers type
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 7 14:49:56 PDT 2023
arsenm requested changes to this revision.
arsenm added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:259-265
+static unsigned getPtrOrVecOfPtrsAddressSpace(Type *Ty) {
+ if (Ty->isVectorTy()) {
+ Ty = cast<VectorType>(Ty)->getElementType();
+ }
+ assert(Ty->isPointerTy());
+ return Ty->getPointerAddressSpace();
+}
----------------
This is reinventing Type::getPointerAddressSpace
================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:268-271
+ if (Ty->isVectorTy()) {
+ Ty = cast<VectorType>(Ty)->getElementType();
+ }
+ return Ty->isPointerTy();
----------------
isPtrOrPtrVectorTy
================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:285
+ Type *NPT =
+ PointerType::getWithSamePointeeType(cast<PointerType>(PT), NewAddrSpace);
+ return VectorType::get(NPT, cast<VectorType>(Ty)->getElementCount());
----------------
Don't need to bother trying to maintain pointer element types anymore
================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:289
+
+static bool hasSameElementOfPtrOrVecPtrs(Type *Ty1, Type *Ty2) {
+ assert(isPtrOrVecOfPtrsType(Ty1) && isPtrOrVecOfPtrsType(Ty2));
----------------
Ditto, only opaque pointers matter now
================
Comment at: llvm/test/Transforms/InferAddressSpaces/AMDGPU/icmp.ll:151
; CHECK-LABEL: @icmp_flat_flat_from_group_vector(
-; CHECK: %cmp = icmp eq <2 x ptr> %cast0, %cast1
+; CHECK: %cmp = icmp eq <2 x ptr addrspace(3)> %group.ptr.0, %group.ptr.1
define <2 x i1> @icmp_flat_flat_from_group_vector(<2 x ptr addrspace(3)> %group.ptr.0, <2 x ptr addrspace(3)> %group.ptr.1) #0 {
----------------
You touched a lot more than just icmp, so this needs more tests to cover all the newly handled cases
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150043/new/
https://reviews.llvm.org/D150043
More information about the llvm-commits
mailing list