Skip to content

Commit 41d9613

Browse files
authored
[mlir-runner] Check entry function not has inputs
This PR fixes a crash if entry function has inputs.
1 parent d0cd6f3 commit 41d9613

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mlir/lib/ExecutionEngine/JitRunner.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,13 @@ static Error compileAndExecuteVoidFunction(
222222
CompileAndExecuteConfig config, std::unique_ptr<llvm::TargetMachine> tm) {
223223
auto mainFunction = dyn_cast_or_null<LLVM::LLVMFuncOp>(
224224
SymbolTable::lookupSymbolIn(module, entryPoint));
225-
if (!mainFunction || mainFunction.empty())
225+
if (!mainFunction || mainFunction.isExternal())
226226
return makeStringError("entry point not found");
227227

228+
if (cast<LLVM::LLVMFunctionType>(mainFunction.getFunctionType())
229+
.getNumParams() != 0)
230+
return makeStringError("function inputs not supported");
231+
228232
auto resultType = dyn_cast<LLVM::LLVMVoidType>(
229233
mainFunction.getFunctionType().getReturnType());
230234
if (!resultType)

0 commit comments

Comments
 (0)