@@ -150,8 +150,7 @@ generatedTypePrinter(Type def, AsmPrinter &printer);
150150
151151bool LLVMArrayType::isValidElementType (Type type) {
152152 return !llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType,
153- LLVMFunctionType, LLVMTokenType, LLVMScalableVectorType>(
154- type);
153+ LLVMFunctionType, LLVMTokenType>(type);
155154}
156155
157156LLVMArrayType LLVMArrayType::get (Type elementType, uint64_t numElements) {
@@ -659,53 +658,6 @@ LogicalResult LLVMStructType::verifyEntries(DataLayoutEntryListRef entries,
659658 return mlir::success ();
660659}
661660
662- // ===----------------------------------------------------------------------===//
663- // LLVMScalableVectorType.
664- // ===----------------------------------------------------------------------===//
665-
666- // / Verifies that the type about to be constructed is well-formed.
667- template <typename VecTy>
668- static LogicalResult
669- verifyVectorConstructionInvariants (function_ref<InFlightDiagnostic()> emitError,
670- Type elementType, unsigned numElements) {
671- if (numElements == 0 )
672- return emitError () << " the number of vector elements must be positive" ;
673-
674- if (!VecTy::isValidElementType (elementType))
675- return emitError () << " invalid vector element type" ;
676-
677- return success ();
678- }
679-
680- LLVMScalableVectorType LLVMScalableVectorType::get (Type elementType,
681- unsigned minNumElements) {
682- assert (elementType && " expected non-null subtype" );
683- return Base::get (elementType.getContext (), elementType, minNumElements);
684- }
685-
686- LLVMScalableVectorType
687- LLVMScalableVectorType::getChecked (function_ref<InFlightDiagnostic()> emitError,
688- Type elementType, unsigned minNumElements) {
689- assert (elementType && " expected non-null subtype" );
690- return Base::getChecked (emitError, elementType.getContext (), elementType,
691- minNumElements);
692- }
693-
694- bool LLVMScalableVectorType::isValidElementType (Type type) {
695- if (auto intType = llvm::dyn_cast<IntegerType>(type))
696- return intType.isSignless ();
697-
698- return isCompatibleFloatingPointType (type) ||
699- llvm::isa<LLVMPointerType>(type);
700- }
701-
702- LogicalResult
703- LLVMScalableVectorType::verify (function_ref<InFlightDiagnostic()> emitError,
704- Type elementType, unsigned numElements) {
705- return verifyVectorConstructionInvariants<LLVMScalableVectorType>(
706- emitError, elementType, numElements);
707- }
708-
709661// ===----------------------------------------------------------------------===//
710662// LLVMTargetExtType.
711663// ===----------------------------------------------------------------------===//
@@ -764,7 +716,6 @@ bool mlir::LLVM::isCompatibleOuterType(Type type) {
764716 LLVMPointerType,
765717 LLVMStructType,
766718 LLVMTokenType,
767- LLVMScalableVectorType,
768719 LLVMTargetExtType,
769720 LLVMVoidType,
770721 LLVMX86AMXType
@@ -812,7 +763,6 @@ static bool isCompatibleImpl(Type type, DenseSet<Type> &compatibleTypes) {
812763 })
813764 // clang-format off
814765 .Case <
815- LLVMScalableVectorType,
816766 LLVMArrayType
817767 >([&](auto containerType) {
818768 return isCompatible (containerType.getElementType ());
@@ -859,9 +809,6 @@ bool mlir::LLVM::isCompatibleFloatingPointType(Type type) {
859809}
860810
861811bool mlir::LLVM::isCompatibleVectorType (Type type) {
862- if (llvm::isa<LLVMScalableVectorType>(type))
863- return true ;
864-
865812 if (auto vecType = llvm::dyn_cast<VectorType>(type)) {
866813 if (vecType.getRank () != 1 )
867814 return false ;
@@ -876,8 +823,7 @@ bool mlir::LLVM::isCompatibleVectorType(Type type) {
876823
877824Type mlir::LLVM::getVectorElementType (Type type) {
878825 return llvm::TypeSwitch<Type, Type>(type)
879- .Case <LLVMScalableVectorType, VectorType>(
880- [](auto ty) { return ty.getElementType (); })
826+ .Case <VectorType>([](auto ty) { return ty.getElementType (); })
881827 .Default ([](Type) -> Type {
882828 llvm_unreachable (" incompatible with LLVM vector type" );
883829 });
@@ -890,37 +836,22 @@ llvm::ElementCount mlir::LLVM::getVectorNumElements(Type type) {
890836 return llvm::ElementCount::getScalable (ty.getNumElements ());
891837 return llvm::ElementCount::getFixed (ty.getNumElements ());
892838 })
893- .Case ([](LLVMScalableVectorType ty) {
894- return llvm::ElementCount::getScalable (ty.getMinNumElements ());
895- })
896839 .Default ([](Type) -> llvm::ElementCount {
897840 llvm_unreachable (" incompatible with LLVM vector type" );
898841 });
899842}
900843
901844bool mlir::LLVM::isScalableVectorType (Type vectorType) {
902- assert (( llvm::isa<LLVMScalableVectorType, VectorType>(vectorType) ) &&
845+ assert (llvm::isa<VectorType>(vectorType) &&
903846 " expected LLVM-compatible vector type" );
904- return llvm::isa<LLVMScalableVectorType>(vectorType) ||
905- llvm::cast<VectorType>(vectorType).isScalable ();
847+ return llvm::cast<VectorType>(vectorType).isScalable ();
906848}
907849
908850Type mlir::LLVM::getVectorType (Type elementType, unsigned numElements,
909851 bool isScalable) {
910- if (!isScalable) {
911- // Non-scalable vectors always use the MLIR vector type.
912- assert (VectorType::isValidElementType (elementType) &&
913- " incompatible element type" );
914- return VectorType::get (numElements, elementType, {false });
915- }
916-
917- // This is a scalable vector.
918- if (VectorType::isValidElementType (elementType))
919- return VectorType::get (numElements, elementType, {true });
920- assert (LLVMScalableVectorType::isValidElementType (elementType) &&
921- " neither the MLIR vector type nor LLVMScalableVectorType is "
922- " compatible with the specified element type" );
923- return LLVMScalableVectorType::get (elementType, numElements);
852+ assert (VectorType::isValidElementType (elementType) &&
853+ " incompatible element type" );
854+ return VectorType::get (numElements, elementType, {isScalable});
924855}
925856
926857Type mlir::LLVM::getVectorType (Type elementType,
@@ -939,15 +870,6 @@ Type mlir::LLVM::getFixedVectorType(Type elementType, unsigned numElements) {
939870}
940871
941872Type mlir::LLVM::getScalableVectorType (Type elementType, unsigned numElements) {
942- bool useLLVM = LLVMScalableVectorType::isValidElementType (elementType);
943- bool useBuiltIn = VectorType::isValidElementType (elementType);
944- (void )useBuiltIn;
945- assert ((useLLVM ^ useBuiltIn) && " expected LLVM-compatible scalable-vector "
946- " type to be either builtin or LLVM dialect "
947- " type" );
948- if (useLLVM)
949- return LLVMScalableVectorType::get (elementType, numElements);
950-
951873 // LLVM vectors are always 1-D, hence only 1 bool is required to mark it as
952874 // scalable/non-scalable.
953875 return VectorType::get (numElements, elementType, /* scalableDims=*/ true );
0 commit comments