diff --git a/mlir/lib/Dialect/Async/IR/Async.cpp b/mlir/lib/Dialect/Async/IR/Async.cpp --- a/mlir/lib/Dialect/Async/IR/Async.cpp +++ b/mlir/lib/Dialect/Async/IR/Async.cpp @@ -126,9 +126,10 @@ // (%value as %unwrapped: !async.value, ...) 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 << ")"; }