[Mlir-commits] [mlir] Revert "[mlir]Fix dialect conversion drop uses" (PR #87205)

Mehdi Amini llvmlistbot at llvm.org
Sun Mar 31 14:25:52 PDT 2024


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/87205

Reverts llvm/llvm-project#86991

Some bots are broken with a leak being detected now.

>From 9c70ea959872a607dd7ddea24fc642db938c7f82 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Sun, 31 Mar 2024 23:25:12 +0200
Subject: [PATCH] Revert "[mlir]Fix dialect conversion drop uses (#86991)"

This reverts commit 0030fc4ac74a9ce645adb9d59e108da4d4d11818.
---
 mlir/lib/Transforms/Utils/DialectConversion.cpp     |  8 +++-----
 .../TosaToLinalg/tosa-to-linalg-invalid.mlir        | 13 -------------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 3c72c8789e8ec5..2ec0b964b304f6 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -279,13 +279,11 @@ class CreateBlockRewrite : public BlockRewrite {
     auto &blockOps = block->getOperations();
     while (!blockOps.empty())
       blockOps.remove(blockOps.begin());
-    block->dropAllDefinedValueUses();
-    if (block->getParent()) {
+    block->dropAllUses();
+    if (block->getParent())
       block->erase();
-    } else {
-      block->dropAllDefinedValueUses();
+    else
       delete block;
-    }
   }
 };
 
diff --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir
index 6494e1b2719487..17eec593691860 100644
--- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir
+++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir
@@ -15,16 +15,3 @@ func.func @tensor_with_unknown_rank(%arg0: tensor<*xi8>) -> tensor<*xi8> {
   %0 = "tosa.abs"(%arg0) : (tensor<*xi8>) -> tensor<*xi8>
   return %0 : tensor<*xi8>
 }
-
-// -----
-
-// CHECK-LABEL: @unranked_add
-func.func @unranked_add(%arg0 : tensor<10x10xf32> , %arg1 : tensor<10x10xf32>, %arg2 : tensor<*xf32>) -> (tensor<10x10xf32>) {
-  // expected-error at +3 {{failed to legalize operation 'tosa.add'}}
-  %reduce = tosa.reduce_max %arg0 {axis = 1 : i32} : (tensor<10x10xf32>) -> tensor<10x1xf32>
-  %1 = tosa.add %reduce, %arg1 : (tensor<10x1xf32>, tensor<10x10xf32>) -> tensor<10x10xf32>
-  %0 = tosa.add %1, %arg2 : (tensor<10x10xf32>, tensor<*xf32>) -> tensor<*xf32>
-  %2 = tosa.reshape %0 {new_shape = array<i64: 10, 10>} : (tensor<*xf32>) -> tensor<10x10xf32>
-  return %2 : tensor<10x10xf32>
-}
-



More information about the Mlir-commits mailing list