[Mlir-commits] [mlir] [mlir][arith] Refine the verifier for arith.constant (PR #86178)
Jakub Kuderski
llvmlistbot at llvm.org
Fri Mar 22 08:26:13 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())
----------------
kuhar wrote:
> Interesting idea - I've not thought about it, no. Thanks for the suggestion! Though isa<ScalableVectorType>(...) would be longer than vecType.isScalable() 🤷🏻
only if you have a vector type already. if the starting point is just `Type`, you could do `auto scalableTy = dyn_cast<ScalableVectorType>(myType):`
https://github.com/llvm/llvm-project/pull/86178
More information about the Mlir-commits
mailing list