[Mlir-commits] [mlir] [MemRef] Document `reinterpret_cast` verifiers (PR #214505)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Aug 6 08:09:38 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: ioana ghiban (ioghiban)

<details>
<summary>Changes</summary>

Make the loose semantics assumed by this operation more explicit via documentation.

---
Full diff: https://github.com/llvm/llvm-project/pull/214505.diff


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td (+6) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index 8f530b2dbd62e..3122e7b633870 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -1511,6 +1511,12 @@ def MemRef_ReinterpretCastOp
     Consecutive `reinterpret_cast` operations on memref's with static
     dimensions.
 
+    This operation is intended for cases where the user can guarantee the
+    validity of the constructed descriptor. Neither static nor runtime
+    verification check that the resulting descriptor is in-bounds. Accessing
+    memory outside the underlying allocation through the resulting memref is
+    undefined behavior.
+
     We distinguish between *underlying memory* — the sequence of elements as
     they appear in the contiguous memory of the memref — and the
     *strided memref*, which refers to the underlying memory interpreted

``````````

</details>


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


More information about the Mlir-commits mailing list