[Mlir-commits] [mlir] 674dd9d - [mlir] Fix body-less async.execute printing

Christian Sigg llvmlistbot at llvm.org
Tue Jun 8 23:07:29 PDT 2021


Author: Christian Sigg
Date: 2021-06-09T08:07:11+02:00
New Revision: 674dd9d08ec085a82f2a4b3236a890644b4d0bc2

URL: https://github.com/llvm/llvm-project/commit/674dd9d08ec085a82f2a4b3236a890644b4d0bc2
DIFF: https://github.com/llvm/llvm-project/commit/674dd9d08ec085a82f2a4b3236a890644b4d0bc2.diff

LOG: [mlir] Fix body-less async.execute printing

Reviewed By: ezhulenev

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

Added: 
    

Modified: 
    mlir/lib/Dialect/Async/IR/Async.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Async/IR/Async.cpp b/mlir/lib/Dialect/Async/IR/Async.cpp
index 6f2f69d2627c7..a06b2b6664690 100644
--- a/mlir/lib/Dialect/Async/IR/Async.cpp
+++ b/mlir/lib/Dialect/Async/IR/Async.cpp
@@ -126,9 +126,10 @@ static void print(OpAsmPrinter &p, ExecuteOp op) {
   // (%value as %unwrapped: !async.value<!arg.type>, ...)
   if (!op.operands().empty()) {
     p << " (";
+    Block *entry = op.body().empty() ? nullptr : &op.body().front();
     llvm::interleaveComma(op.operands(), p, [&, n = 0](Value operand) mutable {
-      p << operand << " as " << op.body().front().getArgument(n++) << ": "
-        << operand.getType();
+      Value argument = entry ? entry->getArgument(n++) : Value();
+      p << operand << " as " << argument << ": " << operand.getType();
     });
     p << ")";
   }


        


More information about the Mlir-commits mailing list