summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mlir/lib/IR/AsmPrinter.cpp18
-rw-r--r--mlir/test/IR/wrapping_op.mlir3
2 files changed, 10 insertions, 11 deletions
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 49830aae485..afb94fea0cd 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -1936,16 +1936,14 @@ void OperationPrinter::printOperation(Operation *op) {
os << " = ";
}
- // TODO(riverriddle): FuncOp cannot be round-tripped currently, as
- // FunctionType cannot be used in a TypeAttr.
- if (printerFlags.shouldPrintGenericOpForm() && !isa<FuncOp>(op))
- return printGenericOp(op);
-
- // Check to see if this is a known operation. If so, use the registered
- // custom printer hook.
- if (auto *opInfo = op->getAbstractOperation()) {
- opInfo->printAssembly(op, *this);
- return;
+ // If requested, always print the generic form.
+ if (!printerFlags.shouldPrintGenericOpForm()) {
+ // Check to see if this is a known operation. If so, use the registered
+ // custom printer hook.
+ if (auto *opInfo = op->getAbstractOperation()) {
+ opInfo->printAssembly(op, *this);
+ return;
+ }
}
// Otherwise print with the generic assembly form.
diff --git a/mlir/test/IR/wrapping_op.mlir b/mlir/test/IR/wrapping_op.mlir
index 9212e8930ac..92918f11688 100644
--- a/mlir/test/IR/wrapping_op.mlir
+++ b/mlir/test/IR/wrapping_op.mlir
@@ -2,7 +2,7 @@
// RUN: mlir-opt -mlir-print-op-generic -mlir-print-debuginfo %s | FileCheck %s --check-prefix=CHECK-GENERIC
// CHECK-LABEL: func @wrapping_op
-// CHECK-GENERIC-LABEL: func @wrapping_op
+// CHECK-GENERIC: "func"
func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) {
// CHECK: %0:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3)
// CHECK-GENERIC: "test.wrapping_region"() ( {
@@ -12,3 +12,4 @@ func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) {
%res:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) { test.attr = "attr" } : (f32, i32) -> (i1, i2, i3) loc("some_NameLoc")
return %res#2, %res#1, %res#0 : i3, i2, i1
}
+// CHECK-GENERIC: sym_name = "wrapping_op"
OpenPOWER on IntegriCloud