[Mlir-commits] [mlir] [mlir][SPIR-V] Fix ConvertUToPtr verifier error message (NFC) (PR #202899)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 10 02:15:19 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Arseniy Obolenskiy (aobolensk)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/202899.diff


2 Files Affected:

- (modified) mlir/lib/Dialect/SPIRV/IR/CastOps.cpp (+1-1) 
- (modified) mlir/test/Dialect/SPIRV/IR/cast-ops.mlir (+10) 


``````````diff
diff --git a/mlir/lib/Dialect/SPIRV/IR/CastOps.cpp b/mlir/lib/Dialect/SPIRV/IR/CastOps.cpp
index ea8cb8de74536..e8bbb8016baf6 100644
--- a/mlir/lib/Dialect/SPIRV/IR/CastOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/CastOps.cpp
@@ -166,7 +166,7 @@ LogicalResult ConvertUToPtrOp::verify() {
   auto operandType = cast<spirv::ScalarType>(getOperand().getType());
   auto resultType = cast<spirv::PointerType>(getResult().getType());
   if (!operandType || !operandType.isSignlessInteger())
-    return emitError("result must be a scalar type of unsigned integer");
+    return emitError("operand must be a scalar type of unsigned integer");
   auto spirvModule = (*this)->getParentOfType<spirv::ModuleOp>();
   if (!spirvModule)
     return success();
diff --git a/mlir/test/Dialect/SPIRV/IR/cast-ops.mlir b/mlir/test/Dialect/SPIRV/IR/cast-ops.mlir
index 6614a49a1253e..2bd992979e2ab 100644
--- a/mlir/test/Dialect/SPIRV/IR/cast-ops.mlir
+++ b/mlir/test/Dialect/SPIRV/IR/cast-ops.mlir
@@ -571,3 +571,13 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
     spirv.Return
   }
 }
+
+// -----
+
+spirv.module Physical64 OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses], []> {
+  spirv.func @covert_u_to_ptr_invalid_operand(%arg0 : si32) "None" {
+    // expected-error @+1 {{operand must be a scalar type of unsigned integer}}
+    %0 = spirv.ConvertUToPtr %arg0 : si32 to !spirv.ptr<i32, Generic>
+    spirv.Return
+  }
+}

``````````

</details>


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


More information about the Mlir-commits mailing list