@@ -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) {
@@ -657,53 +656,6 @@ LogicalResult LLVMStructType::verifyEntries(DataLayoutEntryListRef entries,
657656 return mlir::success ();
658657}
659658
660- // ===----------------------------------------------------------------------===//
661- // LLVMScalableVectorType.
662- // ===----------------------------------------------------------------------===//
663-
664- // / Verifies that the type about to be constructed is well-formed.
665- template <typename VecTy>
666- static LogicalResult
667- verifyVectorConstructionInvariants (function_ref<InFlightDiagnostic()> emitError,
668- Type elementType, unsigned numElements) {
669- if (numElements == 0 )
670- return emitError () << " the number of vector elements must be positive" ;
671-
672- if (!VecTy::isValidElementType (elementType))
673- return emitError () << " invalid vector element type" ;
674-
675- return success ();
676- }
677-
678- LLVMScalableVectorType LLVMScalableVectorType::get (Type elementType,
679- unsigned minNumElements) {
680- assert (elementType && " expected non-null subtype" );
681- return Base::get (elementType.getContext (), elementType, minNumElements);
682- }
683-
684- LLVMScalableVectorType
685- LLVMScalableVectorType::getChecked (function_ref<InFlightDiagnostic()> emitError,
686- Type elementType, unsigned minNumElements) {
687- assert (elementType && " expected non-null subtype" );
688- return Base::getChecked (emitError, elementType.getContext (), elementType,
689- minNumElements);
690- }
691-
692- bool LLVMScalableVectorType::isValidElementType (Type type) {
693- if (auto intType = llvm::dyn_cast<IntegerType>(type))
694- return intType.isSignless ();
695-
696- return isCompatibleFloatingPointType (type) ||
697- llvm::isa<LLVMPointerType>(type);
698- }
699-
700- LogicalResult
701- LLVMScalableVectorType::verify (function_ref<InFlightDiagnostic()> emitError,
702- Type elementType, unsigned numElements) {
703- return verifyVectorConstructionInvariants<LLVMScalableVectorType>(
704- emitError, elementType, numElements);
705- }
706-
707659// ===----------------------------------------------------------------------===//
708660// LLVMTargetExtType.
709661// ===----------------------------------------------------------------------===//
@@ -762,7 +714,6 @@ bool mlir::LLVM::isCompatibleOuterType(Type type) {
762714 LLVMPointerType,
763715 LLVMStructType,
764716 LLVMTokenType,
765- LLVMScalableVectorType,
766717 LLVMTargetExtType,
767718 LLVMVoidType,
768719 LLVMX86AMXType
@@ -810,7 +761,6 @@ static bool isCompatibleImpl(Type type, DenseSet<Type> &compatibleTypes) {
810761 })
811762 // clang-format off
812763 .Case <
813- LLVMScalableVectorType,
814764 LLVMArrayType
815765 >([&](auto containerType) {
816766 return isCompatible (containerType.getElementType ());
@@ -857,9 +807,6 @@ bool mlir::LLVM::isCompatibleFloatingPointType(Type type) {
857807}
858808
859809bool mlir::LLVM::isCompatibleVectorType (Type type) {
860- if (llvm::isa<LLVMScalableVectorType>(type))
861- return true ;
862-
863810 if (auto vecType = llvm::dyn_cast<VectorType>(type)) {
864811 if (vecType.getRank () != 1 )
865812 return false ;
@@ -874,8 +821,7 @@ bool mlir::LLVM::isCompatibleVectorType(Type type) {
874821
875822Type mlir::LLVM::getVectorElementType (Type type) {
876823 return llvm::TypeSwitch<Type, Type>(type)
877- .Case <LLVMScalableVectorType, VectorType>(
878- [](auto ty) { return ty.getElementType (); })
824+ .Case <VectorType>([](auto ty) { return ty.getElementType (); })
879825 .Default ([](Type) -> Type {
880826 llvm_unreachable (" incompatible with LLVM vector type" );
881827 });
@@ -888,37 +834,22 @@ llvm::ElementCount mlir::LLVM::getVectorNumElements(Type type) {
888834 return llvm::ElementCount::getScalable (ty.getNumElements ());
889835 return llvm::ElementCount::getFixed (ty.getNumElements ());
890836 })
891- .Case ([](LLVMScalableVectorType ty) {
892- return llvm::ElementCount::getScalable (ty.getMinNumElements ());
893- })
894837 .Default ([](Type) -> llvm::ElementCount {
895838 llvm_unreachable (" incompatible with LLVM vector type" );
896839 });
897840}
898841
899842bool mlir::LLVM::isScalableVectorType (Type vectorType) {
900- assert (( llvm::isa<LLVMScalableVectorType, VectorType>(vectorType) ) &&
843+ assert (llvm::isa<VectorType>(vectorType) &&
901844 " expected LLVM-compatible vector type" );
902- return llvm::isa<LLVMScalableVectorType>(vectorType) ||
903- llvm::cast<VectorType>(vectorType).isScalable ();
845+ return llvm::cast<VectorType>(vectorType).isScalable ();
904846}
905847
906848Type mlir::LLVM::getVectorType (Type elementType, unsigned numElements,
907849 bool isScalable) {
908- if (!isScalable) {
909- // Non-scalable vectors always use the MLIR vector type.
910- assert (VectorType::isValidElementType (elementType) &&
911- " incompatible element type" );
912- return VectorType::get (numElements, elementType, {false });
913- }
914-
915- // This is a scalable vector.
916- if (VectorType::isValidElementType (elementType))
917- return VectorType::get (numElements, elementType, {true });
918- assert (LLVMScalableVectorType::isValidElementType (elementType) &&
919- " neither the MLIR vector type nor LLVMScalableVectorType is "
920- " compatible with the specified element type" );
921- return LLVMScalableVectorType::get (elementType, numElements);
850+ assert (VectorType::isValidElementType (elementType) &&
851+ " incompatible element type" );
852+ return VectorType::get (numElements, elementType, {isScalable});
922853}
923854
924855Type mlir::LLVM::getVectorType (Type elementType,
@@ -937,15 +868,6 @@ Type mlir::LLVM::getFixedVectorType(Type elementType, unsigned numElements) {
937868}
938869
939870Type mlir::LLVM::getScalableVectorType (Type elementType, unsigned numElements) {
940- bool useLLVM = LLVMScalableVectorType::isValidElementType (elementType);
941- bool useBuiltIn = VectorType::isValidElementType (elementType);
942- (void )useBuiltIn;
943- assert ((useLLVM ^ useBuiltIn) && " expected LLVM-compatible scalable-vector "
944- " type to be either builtin or LLVM dialect "
945- " type" );
946- if (useLLVM)
947- return LLVMScalableVectorType::get (elementType, numElements);
948-
949871 // LLVM vectors are always 1-D, hence only 1 bool is required to mark it as
950872 // scalable/non-scalable.
951873 return VectorType::get (numElements, elementType, /* scalableDims=*/ true );
0 commit comments