[Mlir-commits] [mlir] [mlir][SPIRV] Handle missing return value in `FuncOp::verifyBody` (PR #210566)

Igor Wodiany llvmlistbot at llvm.org
Wed Sep 23 01:49:24 PDT 2026


================
@@ -1302,6 +1302,9 @@ LogicalResult spirv::FuncOp::verifyBody() {
                    "returns 1 value but enclosing function requires ")
                << fnType.getNumResults() << " results";
 
+      if (retOp->getNumOperands() == 0 || !retOp.getValue())
----------------
IgWod wrote:

Looking at the test, I think this is something that should be verified by `ReturnValue` verifier, not by the body verifier. SPIR-V spec requires value to be always present (it's not optional) and I believe that's already enforced, since `ReturnValue` takes one non-optional argument in the .td definition. I think the problem is that Void/None type is allowed whereas SPIR-V forbids it:

> Value must not have type [OpTypeVoid](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpTypeVoid).

Could you try fixing that instead and see if that resolves the issue? Fix should probably live in .td.

https://github.com/llvm/llvm-project/pull/210566


More information about the Mlir-commits mailing list