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

Arseniy Obolenskiy llvmlistbot at llvm.org
Wed Jun 10 02:14:35 PDT 2026


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

None

>From 6e7de8093dbf49f78bab4f3f15690d413ed9eff4 Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <arseniy.obolenskiy at amd.com>
Date: Wed, 10 Jun 2026 11:13:59 +0200
Subject: [PATCH] [mlir][SPIR-V] Fix ConvertUToPtr verifier error message (NFC)

---
 mlir/lib/Dialect/SPIRV/IR/CastOps.cpp    |  2 +-
 mlir/test/Dialect/SPIRV/IR/cast-ops.mlir | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

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