[Mlir-commits] [mlir] [mlir][armsme][vector] Replace splat with broadcast (PR #148024)

Diego Caballero llvmlistbot at llvm.org
Tue Jul 22 11:25:52 PDT 2025


================
@@ -790,11 +730,25 @@ struct ExtractFromCreateMaskToPselLowering
   }
 };
 
+// Convert all `vector.splat` to `vector.broadcast`. There is a path from
+// `vector.broadcast` to ArmSME via another pattern.
+struct ConvertSplatToBroadcast : public OpRewritePattern<vector::SplatOp> {
+  using OpRewritePattern<vector::SplatOp>::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(vector::SplatOp splatOp,
+                                PatternRewriter &rewriter) const final {
+
+    rewriter.replaceOpWithNewOp<vector::BroadcastOp>(splatOp, splatOp.getType(),
+                                                     splatOp.getInput());
+    return success();
+  }
+};
+
----------------
dcaballe wrote:

Do we need to go through this conversion if we are planning to remove `vector.splat`?

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


More information about the Mlir-commits mailing list