diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -1921,7 +1921,7 @@ os << ") -> "; ArrayRef results = funcTy.getResults(); if (results.size() == 1 && !results[0].isa()) { - os << results[0]; + printType(results[0]); } else { os << '('; interleaveComma(results, [&](Type ty) { printType(ty); }); @@ -1932,7 +1932,8 @@ os << "vector<"; for (int64_t dim : vectorTy.getShape()) os << dim << 'x'; - os << vectorTy.getElementType() << '>'; + printType(vectorTy.getElementType()); + os << '>'; }) .Case([&](RankedTensorType tensorTy) { os << "tensor<"; @@ -1943,7 +1944,7 @@ os << dim; os << 'x'; } - os << tensorTy.getElementType(); + printType(tensorTy.getElementType()); // Only print the encoding attribute value if set. if (tensorTy.getEncoding()) { os << ", "; diff --git a/mlir/test/IR/print-attr-type-aliases.mlir b/mlir/test/IR/print-attr-type-aliases.mlir --- a/mlir/test/IR/print-attr-type-aliases.mlir +++ b/mlir/test/IR/print-attr-type-aliases.mlir @@ -24,3 +24,7 @@ // CHECK-DAG: #test_encoding = "alias_test:tensor_encoding" // CHECK-DAG: tensor<32xf32, #test_encoding> "test.op"() : () -> tensor<32xf32, "alias_test:tensor_encoding"> + +// CHECK-DAG: !test_ui8_ = type !test.int +// CHECK-DAG: tensor<32x!test_ui8_> +"test.op"() : () -> tensor<32x!test.int> diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp --- a/mlir/test/lib/Dialect/Test/TestDialect.cpp +++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -88,6 +88,14 @@ return AliasResult::FinalAlias; } } + if (auto intType = type.dyn_cast()) { + if (intType.getSignedness() == + TestIntegerType::SignednessSemantics::Unsigned && + intType.getWidth() == 8) { + os << "test_ui8"; + return AliasResult::FinalAlias; + } + } return AliasResult::NoAlias; } diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -32,14 +32,13 @@ auto loc = parser.getCurrentLocation(); if (parser.parseKeyword(&signStr)) return failure(); - if (signStr.compare_insensitive("u") || - signStr.compare_insensitive("unsigned")) + if (signStr.equals_insensitive("u") || signStr.equals_insensitive("unsigned")) result = TestIntegerType::SignednessSemantics::Unsigned; - else if (signStr.compare_insensitive("s") || - signStr.compare_insensitive("signed")) + else if (signStr.equals_insensitive("s") || + signStr.equals_insensitive("signed")) result = TestIntegerType::SignednessSemantics::Signed; - else if (signStr.compare_insensitive("n") || - signStr.compare_insensitive("none")) + else if (signStr.equals_insensitive("n") || + signStr.equals_insensitive("none")) result = TestIntegerType::SignednessSemantics::Signless; else return parser.emitError(loc, "expected signed, unsigned, or none"); diff --git a/mlir/test/mlir-tblgen/testdialect-typedefs.mlir b/mlir/test/mlir-tblgen/testdialect-typedefs.mlir --- a/mlir/test/mlir-tblgen/testdialect-typedefs.mlir +++ b/mlir/test/mlir-tblgen/testdialect-typedefs.mlir @@ -13,12 +13,12 @@ return } -// CHECK: @testInt(%arg0: !test.int, %arg1: !test.int, %arg2: !test.int) +// CHECK: @testInt(%arg0: !test.int, %arg1: !test.int, %arg2: !test.int) func @testInt(%A : !test.int, %B : !test.int, %C : !test.int) { return } -// CHECK: @structTest(%arg0: !test.struct<{field1,!test.smpla},{field2,!test.int}>) +// CHECK: @structTest(%arg0: !test.struct<{field1,!test.smpla},{field2,!test.int}>) func @structTest (%A : !test.struct< {field1, !test.smpla}, {field2, !test.int} > ) { return }