[Mlir-commits] [mlir] [mlir][vector] Support fixed-size masks in `eliminateVectorMasks` (PR #221595)

Federico Bruzzone llvmlistbot at llvm.org
Tue Sep 8 00:49:37 PDT 2026


================
@@ -54,9 +57,25 @@ LogicalResult resolveAllTrueCreateMaskOp(IRRewriter &rewriter,
   for (auto [i, dimSize] : unknownDims) {
     // Compute the lower bound for the unknown dimension (i.e. the smallest
     // value it could be).
+    if (!vscaleRange) {
+      // A constant bound cannot prove a scalable dim, whose runtime size is
+      // `vscale` times the size in the type. Checked first to skip the query.
+      if (maskTypeDimScalableFlags[i])
+        return failure();
+      FailureOr<int64_t> dimLowerBound =
+          ValueBoundsConstraintSet::computeConstantBound(
+              presburger::BoundType::LB, dimSize);
+      if (failed(dimLowerBound))
+        return failure();
+      // If LB < the mask dim size then this dim is not all-true.
+      if (*dimLowerBound < maskTypeDimSizes[i])
+        return failure();
+      continue;
+    }
+
     FailureOr<ConstantOrScalableBound> dimLowerBound =
----------------
FedericoBruzzone wrote:

Nit: `dimLowerBound` is reused with a different type for the scalable branch below. A distinct name (e.g., `scalableLowerBound`) would read slightly clearer from my POV :D


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


More information about the Mlir-commits mailing list