File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1021,6 +1021,14 @@ LogicalResult spirv::FuncOp::verifyType() {
1021
1021
1022
1022
LogicalResult spirv::FuncOp::verifyBody () {
1023
1023
FunctionType fnType = getFunctionType ();
1024
+ if (!isExternal ()) {
1025
+ Block &entryBlock = front ();
1026
+
1027
+ unsigned numArguments = this ->getNumArguments ();
1028
+ if (entryBlock.getNumArguments () != numArguments)
1029
+ return emitOpError (" entry block must have " )
1030
+ << numArguments << " arguments to match function signature" ;
1031
+ }
1024
1032
1025
1033
auto walkResult = walk ([fnType](Operation *op) -> WalkResult {
1026
1034
if (auto retOp = dyn_cast<spirv::ReturnOp>(op)) {
Original file line number Diff line number Diff line change
1
+ // Bug: https://github.com/llvm/llvm-project/issues/132894
2
+
3
+ // RUN: not mlir-opt %s 2>&1 | FileCheck %s
4
+
5
+ // CHECK: error: 'spirv.func' op entry block must have 1 arguments to match function signature
6
+ module {
7
+ spirv.func @f (f32 ) " None" {
8
+ %c0 = arith.constant 0 : index
9
+ spirv.Return
10
+ }
11
+ }
12
+
You can’t perform that action at this time.
0 commit comments