[Mlir-commits] [mlir] Verify element type in SPIR-V's vector-type verifier (PR #177787)

Gabriel Dehame llvmlistbot at llvm.org
Sat Jan 24 11:03:22 PST 2026


https://github.com/gdehame created https://github.com/llvm/llvm-project/pull/177787

None

>From ace83100f0ba2130baefaff346f8f8aa59913d94 Mon Sep 17 00:00:00 2001
From: gdehame <gabrieldehame at gmail.com>
Date: Sat, 24 Jan 2026 20:01:55 +0100
Subject: [PATCH] Verify element type in SPIR-V's vector-type verifier

---
 mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
index 7c3bfd72115e6..c7f2c8bd4e7af 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
@@ -186,6 +186,11 @@ static Type parseAndVerifyType(SPIRVDialect const &dialect,
       parser.emitError(typeLoc, "only 1-D vector allowed but found ") << t;
       return Type();
     }
+    if (!isa<ScalarType>(t.getElementType()))
+      parser.emitError(typeLoc,
+                       "vector element type has to be SPIR-V compatible "
+                       "integer, float or boolean but found ")
+          << t.getElementType();
     if (t.getNumElements() > 4) {
       parser.emitError(
           typeLoc, "vector length has to be less than or equal to 4 but found ")



More information about the Mlir-commits mailing list