[Mlir-commits] [mlir] [mlir][Vector] add vector.insert canonicalization pattern for vectors created from ub.poison (PR #142944)

Diego Caballero llvmlistbot at llvm.org
Tue Jun 24 11:59:31 PDT 2025


================
@@ -3191,6 +3227,109 @@ class InsertSplatToSplat final : public OpRewritePattern<InsertOp> {
   }
 };
 
+// Pattern to optimize a chain of constant insertions into a poison vector.
+//
+// This pattern identifies chains of vector.insert operations that:
+// 1. Start from an ub.poison operation.
+// 2. Insert only constant values at static positions.
+// 3. Completely initialize all elements in the resulting vector.
----------------
dcaballe wrote:

we should probably also check that intermediate inserts have only one use to avoid an explosion of constants. I think we do something like that for the similar cases we have already.

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


More information about the Mlir-commits mailing list