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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 10 03:56:33 PDT 2026


Author: Arseniy Obolenskiy
Date: 2026-06-10T12:56:27+02:00
New Revision: 80460f175cc1db1faa7bfe851139817b8a51e91d

URL: https://github.com/llvm/llvm-project/commit/80460f175cc1db1faa7bfe851139817b8a51e91d
DIFF: https://github.com/llvm/llvm-project/commit/80460f175cc1db1faa7bfe851139817b8a51e91d.diff

LOG: [mlir][SPIR-V] Fix ConvertUToPtr verifier error message (NFC) (#202899)

Added: 
    

Modified: 
    mlir/lib/Dialect/SPIRV/IR/CastOps.cpp
    mlir/test/Dialect/SPIRV/IR/cast-ops.mlir

Removed: 
    


################################################################################
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
+  }
+}


        


More information about the Mlir-commits mailing list