[llvm] a97eab7 - [IR] Allow typed pointers to be used in vector types
Joshua Cranmer via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 27 12:25:38 PDT 2022
Author: Dmitry Sidorov
Date: 2022-10-27T15:25:17-04:00
New Revision: a97eab7d39d4c9203d8a9ff275579cf674117342
URL: https://github.com/llvm/llvm-project/commit/a97eab7d39d4c9203d8a9ff275579cf674117342
DIFF: https://github.com/llvm/llvm-project/commit/a97eab7d39d4c9203d8a9ff275579cf674117342.diff
LOG: [IR] Allow typed pointers to be used in vector types
Reviewed By: nikic, jcranmer-intel
Differential Revision: https://reviews.llvm.org/D136768
Added:
Modified:
llvm/lib/IR/Type.cpp
llvm/lib/IR/Value.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 85b658c8a52ff..6676717b4c597 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -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;
}
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 13600e337f5f4..0fc7f5fe9172c 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -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;
}
More information about the llvm-commits
mailing list