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

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Oct 20 02:26:33 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) {
----------------
banach-space wrote:

Shouldn't this only check the first operand though? For example:
```
%mask = vector.create_mask %c3, %c0, %c0 : vector<4x4x6xi1>
```
This is not `AllFalse` is it?

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


More information about the Mlir-commits mailing list