[Mlir-commits] [mlir] [mlir][Vector] Fold vector.constant_mask to SplatElementsAttr (PR #146724)

Kunwar Grover llvmlistbot at llvm.org
Fri Jul 4 03:30:39 PDT 2025


================
@@ -6594,6 +6594,26 @@ bool ConstantMaskOp::isAllOnesMask() {
   return true;
 }
 
+static Attribute createBoolSplat(ShapedType ty, bool x) {
+  return SplatElementsAttr::get(ty, BoolAttr::get(ty.getContext(), x));
+}
+
+OpFoldResult ConstantMaskOp::fold(FoldAdaptor adaptor) {
+  ArrayRef<int64_t> bounds = getMaskDimSizes();
+  ArrayRef<int64_t> vectorSizes = getVectorType().getShape();
+  // Check the corner case of 0-D vectors first.
+  if (vectorSizes.size() == 0) {
----------------
Groverkss wrote:

moved to .empty

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


More information about the Mlir-commits mailing list