[Mlir-commits] [mlir] [mlir][arith] Refine the verifier for arith.constant (PR #86178)

Andrzej Warzyński llvmlistbot at llvm.org
Mon Apr 8 06:10:25 PDT 2024


================
@@ -190,6 +190,14 @@ LogicalResult arith::ConstantOp::verify() {
     return emitOpError(
         "value must be an integer, float, or elements attribute");
   }
+
+  // Intializing scalable vectors with elements attribute is not supported
+  // unless it's a vector splot.
+  auto vecType = dyn_cast<VectorType>(type);
+  auto val = dyn_cast<DenseElementsAttr>(getValue());
+  if ((vecType && val) && vecType.isScalable() && !val.isSplat())
----------------
banach-space wrote:

@kuhar I went ahead and landed this to unblock myself elsewhere. I've also tried your suggestion and was positively surprised how straightforward that was:
* https://github.com/llvm/llvm-project/pull/87986

@dcaballe I've prepared #87986 as one point in the discussion on `VectorType` refactor. Mainly so that we have a reference. However, having implemented it I feel that it would indeed be a good stepping stone 😅

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


More information about the Mlir-commits mailing list