[llvm] [LLVM][IR] Support target extension types in vectors (PR #140630)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 08:07:47 PDT 2025
================
@@ -790,8 +790,13 @@ VectorType *VectorType::get(Type *ElementType, ElementCount EC) {
}
bool VectorType::isValidElementType(Type *ElemTy) {
- return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
- ElemTy->isPointerTy() || ElemTy->getTypeID() == TypedPointerTyID;
+ if (ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
+ ElemTy->isPointerTy() || ElemTy->getTypeID() == TypedPointerTyID)
+ return true;
+ if (auto *TTy = dyn_cast<TargetExtType>(ElemTy))
+ return TTy->hasProperty(TargetExtType::CanBeVectorElement) &&
+ TTy->isSized();
----------------
nikic wrote:
Rather than checking isSized() here, we should assert that CanBeVectorElement is only set on sized types.
https://github.com/llvm/llvm-project/pull/140630
More information about the llvm-commits
mailing list