Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mlir/lib/ExecutionEngine/JitRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,13 @@ static Error compileAndExecuteVoidFunction(
CompileAndExecuteConfig config, std::unique_ptr<llvm::TargetMachine> tm) {
auto mainFunction = dyn_cast_or_null<LLVM::LLVMFuncOp>(
SymbolTable::lookupSymbolIn(module, entryPoint));
if (!mainFunction || mainFunction.empty())
if (!mainFunction || mainFunction.isExternal())
return makeStringError("entry point not found");

if (cast<LLVM::LLVMFunctionType>(mainFunction.getFunctionType())
.getNumParams() != 0)
return makeStringError("function inputs not supported");

auto resultType = dyn_cast<LLVM::LLVMVoidType>(
mainFunction.getFunctionType().getReturnType());
if (!resultType)
Expand Down
7 changes: 0 additions & 7 deletions mlir/test/mlir-runner/verify-entry-point-result.mlir

This file was deleted.

17 changes: 17 additions & 0 deletions mlir/test/mlir-runner/verify-entry-point.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: not mlir-runner %s -e entry_point -entry-point-result=void 2>&1 | FileCheck %s --check-prefix=CHECK-ENTRY-POINT
// RUN: not mlir-runner %s -e entry_inputs -entry-point-result=void 2>&1 | FileCheck %s --check-prefix=CHECK-ENTRY-INPUTS
// RUN: not mlir-runner %s -e entry_result -entry-point-result=void 2>&1 | FileCheck %s --check-prefix=CHECK-ENTRY-RESULT

// CHECK-ENTRY-POINT: Error: entry point not found
llvm.func @entry_point() -> ()

// CHECK-ENTRY-INPUTS: Error: function inputs not supported
llvm.func @entry_inputs(%arg0: i32) {
llvm.return
}

// CHECK-ENTRY-RESULT: Error: expected void function
llvm.func @entry_result() -> (i32) {
%0 = llvm.mlir.constant(0 : index) : i32
llvm.return %0 : i32
}
Loading