[Mlir-commits] [mlir] Verify element type in SPIR-V's vector-type verifier (PR #177787)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jan 24 11:03:56 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-spirv
Author: Gabriel Dehame (gdehame)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/177787.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp (+5)
``````````diff
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 ")
``````````
</details>
https://github.com/llvm/llvm-project/pull/177787
More information about the Mlir-commits
mailing list