[Mlir-commits] [mlir] [mlir][spirv] Check output of getConstantInt (PR #140568)

Igor Wodiany llvmlistbot at llvm.org
Tue Jun 3 07:32:19 PDT 2025


================
@@ -1061,12 +1061,22 @@ LogicalResult spirv::Deserializer::processCooperativeMatrixTypeKHR(
            << operands[2];
   }
 
-  unsigned rows = getConstantInt(operands[3]).getInt();
-  unsigned columns = getConstantInt(operands[4]).getInt();
+  IntegerAttr rowsAttr = getConstantInt(operands[3]);
+  IntegerAttr columnsAttr = getConstantInt(operands[4]);
+  IntegerAttr useAttr = getConstantInt(operands[5]);
+
+  if (!rowsAttr || !columnsAttr || !useAttr)
+    return emitError(
+               unknownLoc,
+               "OpTypeCooperativeMatrixKHR references undefined constant <id> ")
+           << (rowsAttr ? (columnsAttr ? operands[5] : operands[4])
+                        : operands[3]);
----------------
IgWod-IMG wrote:

Done! I'll merge it once CI is green

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


More information about the Mlir-commits mailing list