[Mlir-commits] [mlir] [mlir][memref] Support reducing copied dims to non-unit in reinterpret_cast elision (PR #209536)

ioana ghiban llvmlistbot at llvm.org
Wed Jul 15 02:03:38 PDT 2026


================
@@ -134,32 +135,31 @@ static std::optional<unsigned> getSingleNonUnitDim(MemRefType type) {
 /// offsets, delinearized offset.
 ///
 /// Supports ranked, static-shape, rank-preserving reinterpret_casts from
-/// identity-layout sources. In addition:
-///     identical to the source identity strides, and exactly one non-unit
-///     source
-///  * Non-scalar results must have static offsets, static result strides
-///     dimension collapsed to unit size
-/// Scalar-shaped results may have arbitrary result strides (i.e. for scalars,
-/// strides are effectively irrelevant).
+/// identity-layout sources.
+/// * Scalar-shaped results may have arbitrary result strides.
+/// * Non-scalar results must have static offsets, static result strides
+///   identical to the source identity strides, and exactly one non-unit
----------------
ioghiban wrote:

Added `@negative_copy_into_strided_no_truncated_dims` test to show the rewrite being skipped if reinterpret_cast changes no dimensions.

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


More information about the Mlir-commits mailing list