[Mlir-commits] [mlir] 6c1436a - [MLIR][SCF] Parenthesize multiple return types in scf.execute_region asm op
Morten Borup Petersen
llvmlistbot at llvm.org
Thu Aug 19 13:33:07 PDT 2021
Author: Morten Borup Petersen
Date: 2021-08-19T21:31:51+01:00
New Revision: 6c1436a9b03e6f87eecf13cccf89b25497b53543
URL: https://github.com/llvm/llvm-project/commit/6c1436a9b03e6f87eecf13cccf89b25497b53543
DIFF: https://github.com/llvm/llvm-project/commit/6c1436a9b03e6f87eecf13cccf89b25497b53543.diff
LOG: [MLIR][SCF] Parenthesize multiple return types in scf.execute_region asm op
Previously, ExecuteRegionOps with multiple return values would fail a round-trip test due to missing parenthesis around the types.
Differential Revision: https://reviews.llvm.org/D108402
Added:
Modified:
mlir/lib/Dialect/SCF/SCF.cpp
mlir/test/Dialect/SCF/ops.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SCF/SCF.cpp b/mlir/lib/Dialect/SCF/SCF.cpp
index 2388162880367..e5c24bb70b851 100644
--- a/mlir/lib/Dialect/SCF/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/SCF.cpp
@@ -115,8 +115,7 @@ static ParseResult parseExecuteRegionOp(OpAsmParser &parser,
static void print(OpAsmPrinter &p, ExecuteRegionOp op) {
p << ExecuteRegionOp::getOperationName();
- if (op.getNumResults() > 0)
- p << " -> " << op.getResultTypes();
+ p.printOptionalArrowTypeList(op.getResultTypes());
p.printRegion(op.region(),
/*printEntryBlockArgs=*/false,
diff --git a/mlir/test/Dialect/SCF/ops.mlir b/mlir/test/Dialect/SCF/ops.mlir
index 08932bfffdc7a..f785b0124296a 100644
--- a/mlir/test/Dialect/SCF/ops.mlir
+++ b/mlir/test/Dialect/SCF/ops.mlir
@@ -291,6 +291,12 @@ func @execute_region() -> i64 {
scf.yield %c1 : i64
}
+ // CHECK: scf.execute_region -> (i64, i64) {
+ %res2:2 = scf.execute_region -> (i64, i64) {
+ %c1 = constant 1 : i64
+ scf.yield %c1, %c1 : i64, i64
+ }
+
// CHECK: scf.execute_region {
// CHECK-NEXT: br ^bb1
// CHECK-NEXT: ^bb1:
More information about the Mlir-commits
mailing list