[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).
----------------
dcaballe wrote:

nit: remove `:` and just just period? "is a vector. Build ..."

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


More information about the Mlir-commits mailing list