diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp index f3f5d12fb6b66c..61499ee59a3020 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp @@ -236,11 +236,12 @@ static LLVMPointerType parsePointerType(DialectAsmParser &parser) { /// Supports both fixed and scalable vectors. static Type parseVectorType(DialectAsmParser &parser) { SmallVector dims; - llvm::SMLoc dimPos; + llvm::SMLoc dimPos, typePos; Type elementType; Location loc = parser.getEncodedSourceLoc(parser.getCurrentLocation()); if (parser.parseLess() || parser.getCurrentLocation(&dimPos) || parser.parseDimensionList(dims, /*allowDynamic=*/true) || + parser.getCurrentLocation(&typePos) || dispatchParse(parser, elementType) || parser.parseGreater()) return Type(); @@ -259,8 +260,11 @@ static Type parseVectorType(DialectAsmParser &parser) { bool isScalable = dims.size() == 2; if (isScalable) return LLVMScalableVectorType::getChecked(loc, elementType, dims[1]); - if (elementType.isSignlessIntOrFloat()) - return VectorType::getChecked(loc, dims, elementType); + if (elementType.isSignlessIntOrFloat()) { + parser.emitError(typePos) + << "cannot use !llvm.vec for built-in primitives, use 'vector' instead"; + return Type(); + } return LLVMFixedVectorType::getChecked(loc, elementType, dims[0]); } @@ -409,7 +413,6 @@ static LLVMStructType parseStructType(DialectAsmParser &parser) { /// LLVM dialect types without the `!llvm` prefix. static Type dispatchParse(DialectAsmParser &parser, bool allowAny = true) { llvm::SMLoc keyLoc = parser.getCurrentLocation(); - Location loc = parser.getEncodedSourceLoc(keyLoc); // Try parsing any MLIR type. Type type; @@ -417,15 +420,9 @@ static Type dispatchParse(DialectAsmParser &parser, bool allowAny = true) { if (result.hasValue()) { if (failed(result.getValue())) return nullptr; - // TODO: integer types are temporarily allowed for compatibility with the - // deprecated !llvm.i[0-9]+ syntax. if (!allowAny) { - auto intType = type.dyn_cast(); - if (!intType || !intType.isSignless()) { - parser.emitError(keyLoc) << "unexpected type, expected keyword"; - return nullptr; - } - emitWarning(loc) << "deprecated syntax, drop '!llvm.' for integers"; + parser.emitError(keyLoc) << "unexpected type, expected keyword"; + return nullptr; } return type; } @@ -438,36 +435,6 @@ static Type dispatchParse(DialectAsmParser &parser, bool allowAny = true) { MLIRContext *ctx = parser.getBuilder().getContext(); return StringSwitch>(key) .Case("void", [&] { return LLVMVoidType::get(ctx); }) - .Case("bfloat", - [&] { - emitWarning(loc) << "deprecated syntax, use bf16 instead"; - return BFloat16Type::get(ctx); - }) - .Case("half", - [&] { - emitWarning(loc) << "deprecated syntax, use f16 instead"; - return Float16Type::get(ctx); - }) - .Case("float", - [&] { - emitWarning(loc) << "deprecated syntax, use f32 instead"; - return Float32Type::get(ctx); - }) - .Case("double", - [&] { - emitWarning(loc) << "deprecated syntax, use f64 instead"; - return Float64Type::get(ctx); - }) - .Case("fp128", - [&] { - emitWarning(loc) << "deprecated syntax, use f128 instead"; - return Float128Type::get(ctx); - }) - .Case("x86_fp80", - [&] { - emitWarning(loc) << "deprecated syntax, use f80 instead"; - return Float80Type::get(ctx); - }) .Case("ppc_fp128", [&] { return LLVMPPCFP128Type::get(ctx); }) .Case("x86_mmx", [&] { return LLVMX86MMXType::get(ctx); }) .Case("token", [&] { return LLVMTokenType::get(ctx); }) diff --git a/mlir/test/Dialect/LLVMIR/types-invalid.mlir b/mlir/test/Dialect/LLVMIR/types-invalid.mlir index d1c661dab51661..cfeab15267e012 100644 --- a/mlir/test/Dialect/LLVMIR/types-invalid.mlir +++ b/mlir/test/Dialect/LLVMIR/types-invalid.mlir @@ -153,35 +153,15 @@ func @scalable_void_vector() { // ----- -// expected-warning @+1 {{deprecated syntax, drop '!llvm.' for integers}} -func private @deprecated_int() -> !llvm.i32 - -// ----- - // expected-error @+1 {{unexpected type, expected keyword}} func private @unexpected_type() -> !llvm.tensor<*xf32> // ----- -// expected-warning @+1 {{deprecated syntax, use bf16 instead}} -func private @deprecated_bfloat() -> !llvm.bfloat - -// ----- - -// expected-warning @+1 {{deprecated syntax, use f16 instead}} -func private @deprecated_half() -> !llvm.half - -// ----- - -// expected-warning @+1 {{deprecated syntax, use f32 instead}} -func private @deprecated_float() -> !llvm.float - -// ----- - -// expected-warning @+1 {{deprecated syntax, use f64 instead}} -func private @deprecated_double() -> !llvm.double +// expected-error @+1 {{unexpected type, expected keyword}} +func private @unexpected_type() -> !llvm.f32 // ----- -// expected-error @+1 {{unexpected type, expected keyword}} -func private @unexpected_type() -> !llvm.f32 +// expected-error @below {{cannot use !llvm.vec for built-in primitives, use 'vector' instead}} +func private @llvm_vector_primitive() -> !llvm.vec<4 x f32> diff --git a/mlir/test/Target/llvmir-intrinsics.mlir b/mlir/test/Target/llvmir-intrinsics.mlir index bbffb8965a3a2a..12b470a8176b8a 100644 --- a/mlir/test/Target/llvmir-intrinsics.mlir +++ b/mlir/test/Target/llvmir-intrinsics.mlir @@ -380,14 +380,14 @@ llvm.func @coro_save(%arg0: !llvm.ptr) { // CHECK-LABEL: @coro_suspend llvm.func @coro_suspend(%arg0: !llvm.token, %arg1 : i1) { // CHECK: call i8 @llvm.coro.suspend - %0 = llvm.intr.coro.suspend %arg0, %arg1 : !llvm.i8 + %0 = llvm.intr.coro.suspend %arg0, %arg1 : i8 llvm.return } // CHECK-LABEL: @coro_end llvm.func @coro_end(%arg0: !llvm.ptr, %arg1 : i1) { // CHECK: call i1 @llvm.coro.end - %0 = llvm.intr.coro.end %arg0, %arg1 : !llvm.i1 + %0 = llvm.intr.coro.end %arg0, %arg1 : i1 llvm.return } diff --git a/mlir/test/Target/openmp-llvm.mlir b/mlir/test/Target/openmp-llvm.mlir index d8bda22fc93cfc..71f0277744f375 100644 --- a/mlir/test/Target/openmp-llvm.mlir +++ b/mlir/test/Target/openmp-llvm.mlir @@ -325,33 +325,33 @@ llvm.func @wsloop_simple(%arg0: !llvm.ptr) { } // CHECK-LABEL: @wsloop_inclusive_1 -llvm.func @wsloop_inclusive_1(%arg0: !llvm.ptr) { - %0 = llvm.mlir.constant(42 : index) : !llvm.i64 - %1 = llvm.mlir.constant(10 : index) : !llvm.i64 - %2 = llvm.mlir.constant(1 : index) : !llvm.i64 +llvm.func @wsloop_inclusive_1(%arg0: !llvm.ptr) { + %0 = llvm.mlir.constant(42 : index) : i64 + %1 = llvm.mlir.constant(10 : index) : i64 + %2 = llvm.mlir.constant(1 : index) : i64 // CHECK: store i64 31, i64* %{{.*}}upperbound "omp.wsloop"(%1, %0, %2) ( { - ^bb0(%arg1: !llvm.i64): - %3 = llvm.mlir.constant(2.000000e+00 : f32) : !llvm.float - %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, !llvm.i64) -> !llvm.ptr - llvm.store %3, %4 : !llvm.ptr + ^bb0(%arg1: i64): + %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 + %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr + llvm.store %3, %4 : !llvm.ptr omp.yield - }) {operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0]> : vector<9xi32>} : (!llvm.i64, !llvm.i64, !llvm.i64) -> () + }) {operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0]> : vector<9xi32>} : (i64, i64, i64) -> () llvm.return } // CHECK-LABEL: @wsloop_inclusive_2 -llvm.func @wsloop_inclusive_2(%arg0: !llvm.ptr) { - %0 = llvm.mlir.constant(42 : index) : !llvm.i64 - %1 = llvm.mlir.constant(10 : index) : !llvm.i64 - %2 = llvm.mlir.constant(1 : index) : !llvm.i64 +llvm.func @wsloop_inclusive_2(%arg0: !llvm.ptr) { + %0 = llvm.mlir.constant(42 : index) : i64 + %1 = llvm.mlir.constant(10 : index) : i64 + %2 = llvm.mlir.constant(1 : index) : i64 // CHECK: store i64 32, i64* %{{.*}}upperbound "omp.wsloop"(%1, %0, %2) ( { - ^bb0(%arg1: !llvm.i64): - %3 = llvm.mlir.constant(2.000000e+00 : f32) : !llvm.float - %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, !llvm.i64) -> !llvm.ptr - llvm.store %3, %4 : !llvm.ptr + ^bb0(%arg1: i64): + %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 + %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr + llvm.store %3, %4 : !llvm.ptr omp.yield - }) {inclusive, operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0]> : vector<9xi32>} : (!llvm.i64, !llvm.i64, !llvm.i64) -> () + }) {inclusive, operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0]> : vector<9xi32>} : (i64, i64, i64) -> () llvm.return }