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

Kunwar Grover llvmlistbot at llvm.org
Wed Jun 25 02:27:34 PDT 2025


================
@@ -3191,6 +3227,114 @@ 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.
----------------
Groverkss wrote:

If all elements are initialized, why does it matter if the operation started from a ub.poison?

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


More information about the Mlir-commits mailing list