[Mlir-commits] [mlir] [mlir][dc] Fix dialect conversion drop uses (PR #86991)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Mar 28 12:00:24 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Rob Suderman (rsuderman)

<details>
<summary>Changes</summary>

Before deleting the block we need to drop uses to the surrounding args. If this is not performed dialect conversion failures can result in a failure to remove args (despite the block having no remaining uses).

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


1 Files Affected:

- (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (+3-1) 


``````````diff
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index f967e8352bf4c8..2460ddf4ef4078 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -277,8 +277,10 @@ class CreateBlockRewrite : public BlockRewrite {
       blockOps.remove(blockOps.begin());
     if (block->getParent())
       eraseBlock(block);
-    else
+    else {
+      block->dropAllDefinedValueUses();
       delete block;
+    }
   }
 };
 

``````````

</details>


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


More information about the Mlir-commits mailing list