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() {
10211021
10221022LogicalResult spirv::FuncOp::verifyBody () {
10231023 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+ }
10241032
10251033 auto walkResult = walk ([fnType](Operation *op) -> WalkResult {
10261034 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