[Mlir-commits] [mlir] [mlir][Tensor] Preserve correct rank expansions in InsertSlice canonicalizer (PR #217361)

Artem Gindinson llvmlistbot at llvm.org
Thu Aug 20 01:33:12 PDT 2026


================
@@ -3044,22 +3055,8 @@ class InsertSliceOpConstantArgumentFolder final
     if (!sliceResult.isValid)
       return failure();
 
-    // Create the new op in canonical form. The refined shape is inferred from
-    // the destination type, but the encoding is a per-value property of the
-    // source: insert_slice does not convert between encodings, so the
-    // produced cast/op must carry the source's encoding (dropping it would
-    // silently discard downstream metadata such as bounds, layout, or
-    // sparsity descriptors). If the source's encoding no longer holds on the
-    // refined shape (e.g. a `VerifiableTensorEncoding` that self-invalidates),
-    // it is dropped in accordance with the encoding's own contract.
-    auto sourceTypeBase = ExtractSliceOp::inferCanonicalRankReducedResultType(
----------------
AGindinson wrote:

Done in 68a3de05a0658c2d5e18e03b90a5f69d416a55a6 and updated the description a bit. Thanks for the suggestion!

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


More information about the Mlir-commits mailing list