[IR] Allow typed pointers to be used in vector types
authorDmitry Sidorov <dmitry.sidorov@intel.com>
Thu, 27 Oct 2022 18:06:22 +0000 (14:06 -0400)
committerJoshua Cranmer <joshua.cranmer@intel.com>
Thu, 27 Oct 2022 19:25:17 +0000 (15:25 -0400)
Reviewed By: nikic, jcranmer-intel

Differential Revision: https://reviews.llvm.org/D136768

llvm/lib/IR/Type.cpp
llvm/lib/IR/Value.cpp

index 85b658c..6676717 100644 (file)
@@ -674,7 +674,7 @@ VectorType *VectorType::get(Type *ElementType, ElementCount EC) {
 
 bool VectorType::isValidElementType(Type *ElemTy) {
   return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
-         ElemTy->isPointerTy();
+         ElemTy->isPointerTy() || ElemTy->getTypeID() == TypedPointerTyID;
 }
 
 //===----------------------------------------------------------------------===//
index 13600e3..0fc7f5f 100644 (file)
@@ -44,7 +44,7 @@ static cl::opt<unsigned> UseDerefAtPointSemantics(
 //===----------------------------------------------------------------------===//
 static inline Type *checkType(Type *Ty) {
   assert(Ty && "Value defined with a null type: Error!");
-  assert(!isa<TypedPointerType>(Ty) &&
+  assert(!isa<TypedPointerType>(Ty->getScalarType()) &&
          "Cannot have values with typed pointer types");
   return Ty;
 }