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 @@ -101,12 +101,17 @@ // Get the underlying value types from async values returned from the // parent `async.execute` operation. auto executeOp = op.getParentOfType(); + + if (executeOp.results().size() != op.getNumOperands()) + return op.emitOpError("number of operands does not match the number of" + "values returned from the parent ExecuteOp"); + auto types = llvm::map_range(executeOp.results(), [](const OpResult &result) { return result.getType().cast().getValueType(); }); if (!std::equal(types.begin(), types.end(), op.getOperandTypes().begin())) - return op.emitOpError("Operand types do not match the types returned from " + return op.emitOpError("operand types do not match the types returned from " "the parent ExecuteOp"); return success();