[Mlir-commits] [mlir] [mlir][ArmSME] Merge consecutive `arm_sme.intr.zero` ops (PR #106215)

Cullen Rhodes llvmlistbot at llvm.org
Tue Aug 27 08:54:10 PDT 2024


================
@@ -855,6 +859,37 @@ struct StreamingVLOpConversion
   }
 };
 
+/// Merges consecutive `arm_sme.intr.zero` operations in a block by bitwise
+/// or-ing the zero masks. Note: In furture the backend _should_ handle this.
+static void mergeConsecutiveTileZerosInBlock(Block *block) {
+  uint32_t mergedZeroMask = 0;
+  SmallVector<arm_sme::aarch64_sme_zero, 16> zeroOpsToMerge;
+  auto replaceMergedZeroOps = [&] {
+    auto cleanup = llvm::make_scope_exit([&] {
+      mergedZeroMask = 0;
+      zeroOpsToMerge.clear();
+    });
+    if (zeroOpsToMerge.size() <= 1)
+      return;
+    IRRewriter rewriter(zeroOpsToMerge.front());
+    rewriter.setInsertionPoint(zeroOpsToMerge.front());
----------------
c-rhodes wrote:

is this not done when creating the rewriter from an op?

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


More information about the Mlir-commits mailing list