[Mlir-commits] [mlir] [mlir][ExecutionEngine] Fixed HWASan error (PR #181151)
Ilgar Gamidov
llvmlistbot at llvm.org
Thu Feb 12 06:22:43 PST 2026
https://github.com/braam-76 created https://github.com/llvm/llvm-project/pull/181151
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
>From 4be07449ae74e261af4b214f4101f9ec328b085e Mon Sep 17 00:00:00 2001
From: braam-76 <braam67.gamidov at yandex.com>
Date: Wed, 4 Feb 2026 16:14:42 +0300
Subject: [PATCH 1/3] [mlir] Return from equals overload
Closes #91233
mlir/include/mlir/ExecutionEngine/MemRefUtils.h:190:No 'return' statement in non-void function
---
mlir/include/mlir/ExecutionEngine/MemRefUtils.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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); }
>From 5f73a4728283cf3c63c0bc3dc7c29e44a532057d Mon Sep 17 00:00:00 2001
From: braam-76 <braam67.gamidov at yandex.com>
Date: Wed, 4 Feb 2026 20:31:14 +0300
Subject: [PATCH 2/3] [mlir] Added OwningMemRef unit test
Pull request #179655
Closes #91233
mlir/include/mlir/ExecutionEngine/MemRefUtils.h:190:No 'return' statement in non-void function
---
mlir/unittests/ExecutionEngine/CMakeLists.txt | 1 +
.../ExecutionEngine/OwningMemRef.cpp | 25 +++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 mlir/unittests/ExecutionEngine/OwningMemRef.cpp
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..3ce11431a305d
--- /dev/null
+++ b/mlir/unittests/ExecutionEngine/OwningMemRef.cpp
@@ -0,0 +1,25 @@
+//===- 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;
+
+TEST(OwningMemRef, 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);
+}
>From ffb9af44b589bcaeecac28a8f38f8174357d6213 Mon Sep 17 00:00:00 2001
From: braam-76 <braam67.gamidov at yandex.com>
Date: Thu, 5 Feb 2026 16:44:09 +0300
Subject: [PATCH 3/3] [mlir][ExecutionEngine] HWASan disabling on OwningMemRef
test
Pull request #179655
https://github.com/llvm/llvm-project/pull/179655#issuecomment-3850858519
https://github.com/llvm/llvm-project/pull/179655#issuecomment-3853452560
---
mlir/unittests/ExecutionEngine/OwningMemRef.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/mlir/unittests/ExecutionEngine/OwningMemRef.cpp b/mlir/unittests/ExecutionEngine/OwningMemRef.cpp
index 3ce11431a305d..f1440e659c34b 100644
--- a/mlir/unittests/ExecutionEngine/OwningMemRef.cpp
+++ b/mlir/unittests/ExecutionEngine/OwningMemRef.cpp
@@ -13,7 +13,18 @@
using namespace ::mlir;
using namespace ::testing;
-TEST(OwningMemRef, assignOverloadChaining) {
+#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};
More information about the Mlir-commits
mailing list