[Mlir-commits] [mlir] [mlir][VectorOps] Add fold `ExtractOp(CreateMask) -> CreateMask` (PR #69456)

Benjamin Maxwell llvmlistbot at llvm.org
Fri Oct 20 02:59:20 PDT 2023


================
@@ -100,6 +100,20 @@ static MaskFormat getMaskFormat(Value mask) {
       return MaskFormat::AllTrue;
     if (allFalse)
       return MaskFormat::AllFalse;
+  } else if (auto m = mask.getDefiningOp<CreateMaskOp>()) {
+    // Finds all-false create_masks. An all-true create_mask requires all
+    // dims to be constants, so that'll be folded to a constant_mask, then
+    // detected in the constant_mask case.
+    auto maskOperands = m.getOperands();
+    for (Value operand : maskOperands) {
----------------
MacDue wrote:

I think that's `AllFalse`? The `create_mask` says it defines a region where the mask is 1. If any of the sizes is zero then the whole mask will be false (i.e. the true region is 3x0x0, so everything must be false).

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


More information about the Mlir-commits mailing list