[Mlir-commits] [mlir] [mlir] Fix correct memset range in `OwningMemRef` zero-init (PR #158200)

Ryan Kim llvmlistbot at llvm.org
Fri Sep 12 03:32:28 PDT 2025


================
@@ -174,9 +174,7 @@ class OwningMemRef {
            it != end; ++it)
         init(*it, it.getIndices());
     } else {
-      memset(descriptor.data, 0,
-             nElements * sizeof(T) +
-                 alignment.value_or(detail::nextPowerOf2(sizeof(T))));
+      memset(descriptor.data, 0, nElements * sizeof(T));
----------------
chokobole wrote:

I suggest to change the member name in `StridedMemRefType`, if you see `data` member, it's hard to guess if it;'s aligned.  

```c++
template <typename T, int N>
struct StridedMemRefType {
  T *basePtr;
  T *data;
```

Maybe then I guess it's better to change them to  `allocatedPtr` and `alignedData`? If you think it's good, then I'll proceed it

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


More information about the Mlir-commits mailing list