[Mlir-commits] [mlir] [mlir][Vector] Verify that masked ops implement MaskableOpInterface (PR #108123)

Diego Caballero llvmlistbot at llvm.org
Wed Sep 11 09:25:07 PDT 2024


================
@@ -6124,7 +6124,9 @@ LogicalResult MaskOp::verify() {
   Block &block = getMaskRegion().getBlocks().front();
   if (block.getOperations().empty())
     return emitOpError("expects a terminator within the mask region");
-  if (block.getOperations().size() > 2)
+
+  unsigned numMaskRegionOps = block.getOperations().size();
+  if (numMaskRegionOps > 2)
     return emitOpError("expects only one operation to mask");
----------------
dcaballe wrote:

Yep, that's why I introduced `numMaskRegionOps` instead of calling `size()` again. However, a valid vector mask would always have 2 ops at most so I thought it would be acceptable. I could implement similar logic with `block.getOperations().empty()` + compare `block.getOperations().begin()` and `block.getOperations().end()` but I think it would make it more confusing... WDYT?

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


More information about the Mlir-commits mailing list