[Mlir-commits] [mlir] [acc] Fix OpenACCUtilsTest to avoid leak in isDeviceValueNonMappableType (PR #176269)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jan 15 15:36:52 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-openacc

Author: Razvan Lupusoru (razvanlupusoru)

<details>
<summary>Changes</summary>

The problem is that the operation is created without an owner, then there is no free. This is being caught in llvm buildbot that are testing sanitizers.

---
Full diff: https://github.com/llvm/llvm-project/pull/176269.diff


1 Files Affected:

- (modified) mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp (+3-2) 


``````````diff
diff --git a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
index 29186ce826d1b..56cc2b9d9ba0b 100644
--- a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
+++ b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
@@ -1435,8 +1435,9 @@ TEST_F(OpenACCUtilsTest, isDeviceValueMemrefNoAddressSpace) {
 
 TEST_F(OpenACCUtilsTest, isDeviceValueNonMappableType) {
   // Test with a non-mappable type (i32 value)
-  auto constOp = arith::ConstantOp::create(b, loc, b.getI32IntegerAttr(42));
-  Value val = constOp.getResult();
+  OwningOpRef<arith::ConstantOp> constOp =
+      arith::ConstantOp::create(b, loc, b.getI32IntegerAttr(42));
+  Value val = constOp->getResult();
 
   // Should return false since i32 is not a MappableType or PointerLikeType
   EXPECT_FALSE(isDeviceValue(val));

``````````

</details>


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


More information about the Mlir-commits mailing list