[Mlir-commits] [mlir] [mlir][vector] Avoid use of vector.splat in transforms (PR #150279)

James Newling llvmlistbot at llvm.org
Wed Jul 23 12:32:22 PDT 2025


================
@@ -966,6 +966,23 @@ struct BreakDownVectorBitCast : public OpRewritePattern<vector::BitCastOp> {
   std::function<bool(BitCastOp)> controlFn;
 };
 
+/// If `value` is the result of a splat or broadcast operation, return the input
+/// of the splat/broadcast operation.
+static Value getBroadcastLikeSource(Value value) {
+
+  Operation *op = value.getDefiningOp();
+  if (!op)
+    return {};
+
+  if (auto broadcast = dyn_cast<vector::BroadcastOp>(op))
+    return broadcast.getSource();
+
----------------
newling wrote:

```suggestion
```

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


More information about the Mlir-commits mailing list