[Mlir-commits] [mlir] [mlir][linalg] Fix memory leak in `vectorize-insert-slice-rank-reducing` test (PR #233435)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Oct 19 06:58:30 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-linalg
Author: Federico Bruzzone (FedericoBruzzone)
<details>
<summary>Changes</summary>
The e2e test added in #<!-- -->226490 bufferizes a `tensor.empty` with `-one-shot-bufferize`, which allocates the buffer but never frees it. The LeakSanitizer reports the leak in builds with ASAN, see [here](https://github.com/llvm/llvm-project/pull/226490#issuecomment-6267203174).
With this PR, the lowered IR now contains the `free` instruction.
**Note**: I could not check the LeakSanitizer report directly, as LSan is not supported on macOS arm64 :(
---
Full diff: https://github.com/llvm/llvm-project/pull/233435.diff
1 Files Affected:
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/vectorize-insert-slice-rank-reducing.mlir (+2-1)
``````````diff
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/vectorize-insert-slice-rank-reducing.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/vectorize-insert-slice-rank-reducing.mlir
index df4cf3729eab8..17274aa5b833c 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/vectorize-insert-slice-rank-reducing.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/vectorize-insert-slice-rank-reducing.mlir
@@ -2,7 +2,8 @@
// DEFINE: %{vectorize} = mlir-opt -transform-interpreter
// DEFINE: %{lower} = mlir-opt -one-shot-bufferize=bufferize-function-boundaries \
-// DEFINE: -test-lower-to-llvm -test-transform-dialect-erase-schedule
+// DEFINE: -buffer-deallocation-pipeline -test-lower-to-llvm \
+// DEFINE: -test-transform-dialect-erase-schedule
// DEFINE: %{run} = mlir-runner -e %{entry_point} -entry-point-result=void \
// DEFINE: -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils
``````````
</details>
https://github.com/llvm/llvm-project/pull/233435
More information about the Mlir-commits
mailing list