[Mlir-commits] [mlir] 2eb5f34 - Fix omitted kw in type alias printer

Jacques Pienaar llvmlistbot at llvm.org
Sun Jan 31 14:07:14 PST 2021


Author: Jacques Pienaar
Date: 2021-01-31T14:06:58-08:00
New Revision: 2eb5f3454212aa906388013e6807a7a906233f18

URL: https://github.com/llvm/llvm-project/commit/2eb5f3454212aa906388013e6807a7a906233f18
DIFF: https://github.com/llvm/llvm-project/commit/2eb5f3454212aa906388013e6807a7a906233f18.diff

LOG: Fix omitted kw in type alias printer

* Fixing missing `type` keyword in alias print
* Add test for large tuple type alias & rerun output to verify printed
form can be parsed (which caught the above).

Added: 
    

Modified: 
    mlir/lib/IR/AsmPrinter.cpp
    mlir/test/IR/print-attr-type-aliases.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 3182e906ce93..d6d81801dc30 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -731,7 +731,7 @@ void AliasState::printAliases(raw_ostream &os, NewLineCounter &newLine,
   }
   for (const auto &it : llvm::make_filter_range(typeToAlias, filterFn)) {
     it.second.print(os << '!');
-    os << " = " << it.first << newLine;
+    os << " = type " << it.first << newLine;
   }
 }
 

diff  --git a/mlir/test/IR/print-attr-type-aliases.mlir b/mlir/test/IR/print-attr-type-aliases.mlir
index b8c22cc26c23..7c343e646376 100644
--- a/mlir/test/IR/print-attr-type-aliases.mlir
+++ b/mlir/test/IR/print-attr-type-aliases.mlir
@@ -1,5 +1,6 @@
 // RUN: mlir-opt %s | FileCheck %s
-
+// Verify printer of type & attr aliases.
+// RUN: mlir-opt %s | mlir-opt | FileCheck %s
 
 // CHECK-DAG: #test2Ealias = "alias_test:dot_in_name"
 "test.op"() {alias_test = "alias_test:dot_in_name"} : () -> ()
@@ -13,3 +14,6 @@
 // CHECK-DAG: #test_alias_conflict0_0 = "alias_test:sanitize_conflict_a"
 // CHECK-DAG: #test_alias_conflict0_1 = "alias_test:sanitize_conflict_b"
 "test.op"() {alias_test = ["alias_test:sanitize_conflict_a", "alias_test:sanitize_conflict_b"]} : () -> ()
+
+// CHECK-DAG: !tuple = type tuple<i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32>
+"test.op"() {alias_test = "alias_test:large_tuple"} : () -> (tuple<i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32>)


        


More information about the Mlir-commits mailing list