[Mlir-commits] [mlir] [mlir][spirv] Fix crash in ArithToSPIRV trunc-i lowering on tensor types (PR #179009)

Jakub Kuderski llvmlistbot at llvm.org
Mon Feb 2 06:34:32 PST 2026


================
@@ -122,6 +122,20 @@ static bool isBoolScalarOrVector(Type type) {
   return false;
 }
 
+/// Returns true if the given `type` is an integer scalar or vector type.
+static bool isIntScalarOrVectorType(Type type) {
+  auto eltTy = getElementTypeOrSelf(type);
+  return eltTy && isa<IntegerType>(eltTy) &&
+         (isa<IntegerType>(type) || isa<VectorType>(type));
+}
----------------
kuhar wrote:

I think we can check for spirv scalar types specifically to generalize this to cover booleans and floats.

```suggestion
static bool isScalarOrVectorOfScalar(Type type) {
  if (isa<spirv::ScalarType>(type)
    return true;
  
  if (auto vecTy = dyn_cast<VectorType>(type))
    return isa<spirv::ScalarType>(vecTy.getElementType());
    
  return false;
}
```

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


More information about the Mlir-commits mailing list