[Mlir-commits] [mlir] 4d93369 - Use type alias for large tuples

Jacques Pienaar llvmlistbot at llvm.org
Fri Jan 29 17:42:46 PST 2021


Author: Jacques Pienaar
Date: 2021-01-29T17:42:23-08:00
New Revision: 4d9336923ec33ff789ed0f32dd0d13a4f902b3aa

URL: https://github.com/llvm/llvm-project/commit/4d9336923ec33ff789ed0f32dd0d13a4f902b3aa
DIFF: https://github.com/llvm/llvm-project/commit/4d9336923ec33ff789ed0f32dd0d13a4f902b3aa.diff

LOG: Use type alias for large tuples

Tuples can occupy quite a lot of space, instead of printing out tuple type
everywhere, just use the type alias if larger (arbitrarily chose a bound for
now).

Differential Revision: https://reviews.llvm.org/D95707

Added: 
    

Modified: 
    mlir/lib/IR/BuiltinDialect.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/BuiltinDialect.cpp b/mlir/lib/IR/BuiltinDialect.cpp
index 138321e734e2..469aa310140c 100644
--- a/mlir/lib/IR/BuiltinDialect.cpp
+++ b/mlir/lib/IR/BuiltinDialect.cpp
@@ -46,6 +46,16 @@ struct BuiltinOpAsmDialectInterface : public OpAsmDialectInterface {
     }
     return failure();
   }
+
+  LogicalResult getAlias(Type type, raw_ostream &os) const final {
+    if (auto tupleType = type.dyn_cast<TupleType>()) {
+      if (tupleType.size() > 16) {
+        os << "tuple";
+        return success();
+      }
+    }
+    return failure();
+  }
 };
 } // end anonymous namespace.
 


        


More information about the Mlir-commits mailing list