[Mlir-commits] [mlir] [mlir][linalg] Fix memory leak in `vectorize-insert-slice-rank-reducing` test (PR #233435)
Federico Bruzzone
llvmlistbot at llvm.org
Mon Oct 19 06:57:46 PDT 2026
https://github.com/FedericoBruzzone created https://github.com/llvm/llvm-project/pull/233435
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 :(
>From ced8219bb117fa3d393f924cceebce354cd2e1d6 Mon Sep 17 00:00:00 2001
From: Federico Bruzzone <federico.bruzzone.i at gmail.com>
Date: Mon, 19 Oct 2026 15:48:44 +0200
Subject: [PATCH] [mlir][linalg] Fix memory leak in
`vectorize-insert-slice-rank-reducing` test
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
---
.../Linalg/CPU/vectorize-insert-slice-rank-reducing.mlir | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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
More information about the Mlir-commits
mailing list