[mlir] Fix body-less async.execute printing

Reviewed By: ezhulenev

Differential Revision: https://reviews.llvm.org/D103686
This commit is contained in:
Christian Sigg 2021-06-04 13:52:34 +02:00
parent 955bc5950b
commit 674dd9d08e
1 changed files with 3 additions and 2 deletions

View File

@ -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 << ")";
}