[Mlir-commits] [mlir] [mlir][ExecutionEngine] Fixed HWASan error (PR #181151)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Feb 12 06:23:24 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Ilgar Gamidov (braam-76)
<details>
<summary>Changes</summary>
Those builder were failing before fix
https://lab.llvm.org/buildbot/#/builders/55/builds/23682
https://lab.llvm.org/buildbot/#/builders/169/builds/19630
https://lab.llvm.org/buildbot/#/builders/24/builds/17229
Previous PR
https://github.com/llvm/llvm-project/pull/179655
Issue
https://github.com/llvm/llvm-project/issues/91233
---
Full diff: https://github.com/llvm/llvm-project/pull/181151.diff
3 Files Affected:
- (modified) mlir/include/mlir/ExecutionEngine/MemRefUtils.h (+2-1)
- (modified) mlir/unittests/ExecutionEngine/CMakeLists.txt (+1)
- (added) mlir/unittests/ExecutionEngine/OwningMemRef.cpp (+36)
``````````diff
diff --git a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
index e9471731afe13..c160a34207b2f 100644
--- a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
@@ -186,11 +186,12 @@ class OwningMemRef {
}
OwningMemRef(const OwningMemRef &) = delete;
OwningMemRef &operator=(const OwningMemRef &) = delete;
- OwningMemRef &operator=(const OwningMemRef &&other) {
+ OwningMemRef &operator=(OwningMemRef &&other) {
freeFunc = other.freeFunc;
descriptor = other.descriptor;
other.freeFunc = nullptr;
memset(&other.descriptor, 0, sizeof(other.descriptor));
+ return *this;
}
OwningMemRef(OwningMemRef &&other) { *this = std::move(other); }
diff --git a/mlir/unittests/ExecutionEngine/CMakeLists.txt b/mlir/unittests/ExecutionEngine/CMakeLists.txt
index b83163e39c014..3e563c65736f5 100644
--- a/mlir/unittests/ExecutionEngine/CMakeLists.txt
+++ b/mlir/unittests/ExecutionEngine/CMakeLists.txt
@@ -9,6 +9,7 @@ add_mlir_unittest(MLIRExecutionEngineTests
DynamicMemRef.cpp
StridedMemRef.cpp
Invoke.cpp
+ OwningMemRef.cpp
)
mlir_target_link_libraries(MLIRExecutionEngineTests
diff --git a/mlir/unittests/ExecutionEngine/OwningMemRef.cpp b/mlir/unittests/ExecutionEngine/OwningMemRef.cpp
new file mode 100644
index 0000000000000..f1440e659c34b
--- /dev/null
+++ b/mlir/unittests/ExecutionEngine/OwningMemRef.cpp
@@ -0,0 +1,36 @@
+//===- StridedMemRef.cpp ----------------------------------------*- C++ -*-===//
+//
+// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/ExecutionEngine/MemRefUtils.h"
+
+#include "gmock/gmock.h"
+
+using namespace ::mlir;
+using namespace ::testing;
+
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
+// hwaddress_sanitizer needs to be turned off for this move-assignment test
+#if __has_feature(hwaddress_sanitizer)
+# define MAYBE_assignOverloadChaining DISABLED_assignOverloadChaining
+#else
+# define MAYBE_assignOverloadChaining assignOverloadChaining
+#endif
+
+TEST(OwningMemRef, MAYBE_assignOverloadChaining) {
+ int64_t mem1Shape[] = {3};
+ int64_t mem2Shape[] = {4};
+
+ OwningMemRef<float, 1> mem1(mem1Shape);
+ OwningMemRef<float, 1> mem2(mem2Shape);
+ OwningMemRef<float, 1> &ref = (mem1 = std::move(mem2));
+
+ EXPECT_EQ(&ref, &mem1);
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/181151
More information about the Mlir-commits
mailing list