[PATCH] D154352: [mlir-cpu-runner] Check entry function is void
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 4 00:34:45 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb27d542b719: [mlir-cpu-runner] Check entry function is void (authored by c-rhodes).
Changed prior to commit:
https://reviews.llvm.org/D154352?vs=536776&id=536975#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154352/new/
https://reviews.llvm.org/D154352
Files:
mlir/lib/ExecutionEngine/JitRunner.cpp
mlir/test/mlir-cpu-runner/verify-entry-point-result.mlir
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 -e 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
+}
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<LLVM::LLVMVoidType>(
+ 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));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154352.536975.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230704/b19fcd45/attachment.bin>
More information about the llvm-commits
mailing list