[Mlir-commits] [mlir] [mlir][Vector] add vector.insert canonicalization pattern to convert a chain of insertions to vector.from_elements (PR #142944)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Aug 4 06:08:39 PDT 2025


================
@@ -3250,6 +3262,130 @@ class InsertSplatToSplat final : public OpRewritePattern<InsertOp> {
     return success();
   }
 };
+
+/// Pattern to optimize a chain of insertions.
+///
+/// This pattern identifies chains of vector.insert operations that:
+/// 1. Only insert values at static positions.
+/// 2. Completely initialize all elements in the resulting vector.
+/// 3. All intermediate insert operations have only one use.
----------------
banach-space wrote:

[nit] It would be helpful if you made references to these high level design points within the implementation (e.g. "Check Cond 1. (only static indices are used)").

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


More information about the Mlir-commits mailing list