Index: mlir/lib/ExecutionEngine/JitRunner.cpp =================================================================== --- mlir/lib/ExecutionEngine/JitRunner.cpp +++ mlir/lib/ExecutionEngine/JitRunner.cpp @@ -224,6 +224,12 @@ SymbolTable::lookupSymbolIn(module, entryPoint)); if (!mainFunction || mainFunction.empty()) return makeStringError("entry point not found"); + + auto resultType = dyn_cast( + mainFunction.getFunctionType().getReturnType()); + if (!resultType) + return makeStringError("expected void function"); + void *empty = nullptr; return compileAndExecute(options, module, entryPoint, std::move(config), &empty, std::move(tm)); Index: mlir/test/mlir-cpu-runner/verify-entry-point-result.mlir =================================================================== --- /dev/null +++ mlir/test/mlir-cpu-runner/verify-entry-point-result.mlir @@ -0,0 +1,7 @@ +// RUN: not mlir-cpu-runner %s entry -entry-point-result=void 2>&1 | FileCheck %s + +// CHECK: Error: expected void function +llvm.func @entry() -> (i32) { + %0 = llvm.mlir.constant(0 : index) : i32 + llvm.return %0 : i32 +}