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

ioana ghiban llvmlistbot at llvm.org
Thu Aug 6 08:08:57 PDT 2026


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

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

>From 6cd18798bf632abb12a451377f65b88421d166c2 Mon Sep 17 00:00:00 2001
From: Ioana Ghiban <ioana.ghiban at arm.com>
Date: Thu, 6 Aug 2026 16:52:56 +0200
Subject: [PATCH] [MemRef] Document `reinterpret_cast` verifiers

---
 mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td | 6 ++++++
 1 file changed, 6 insertions(+)

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



More information about the Mlir-commits mailing list