[Mlir-commits] [mlir] [MLIR][Vector] Added ToElementsOp::fold for broadcast->to_elements pattern rewrite. (PR #160318)
Diego Caballero
llvmlistbot at llvm.org
Tue Sep 30 11:01:53 PDT 2025
================
@@ -2410,6 +2441,85 @@ ToElementsOp::inferReturnTypes(MLIRContext *ctx, std::optional<Location> loc,
return success();
}
+/// Canonicalize `vector.to_elements(vector.broadcast(%v))` where `%v` is a
+/// vector:
+/// - Build `vector.to_elements %v` and remap each destination element to the
+/// corresponding source element using broadcast rules (match or 1 →
+/// replicate).
+///
+/// Example:
+/// %v = vector.broadcast %src : vector<2xf32> to vector<3x2xf32>
+/// %e:6 = vector.to_elements %v : vector<3x2xf32>
----------------
dcaballe wrote:
Add same uses here to illustrate the mapping?
https://github.com/llvm/llvm-project/pull/160318
More information about the Mlir-commits
mailing list