[Mlir-commits] [mlir] emit inbounds and nuw attributes in memref. (PR #138984)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon May 19 11:25:05 PDT 2025


================
@@ -1187,7 +1187,11 @@ def LoadOp : MemRef_Op<"load",
     The `load` op reads an element from a memref at the specified indices.
 
     The number of indices must match the rank of the memref. The indices must
-    be in-bounds: `0 <= idx < dim_size`
+    be in-bounds: `0 <= idx < dim_size`.
+
+    Lowerings of `memref.load` may emit annotations that would cause undefined
+    behavior if indices are out of bounds or if computing the offset in the
+    memref would cause signed overflow of the `index` type.
----------------
banach-space wrote:

Annotation? Don't we call `inbounds` and `nuw` attributes? Also, why not add a specific example (e.g. "e.g., `inbouds` + `nuw` when converting to LLVM's llvm.getelemptr). Some folks may not like this level of detail though.

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


More information about the Mlir-commits mailing list