[Mlir-commits] [mlir] [mlir] Enable remove-dead-values to delete unused private function (PR #161471)

Mehdi Amini llvmlistbot at llvm.org
Mon Oct 6 11:59:40 PDT 2025


================
@@ -235,6 +235,25 @@ static void dropUsesAndEraseResults(Operation *op, BitVector toErase) {
   op->erase();
 }
 
+// Remove the dead functions from moduleOp.
+static void deleteDeadFunction(Operation *module) {
+  bool walkContinue = true;
+  while (walkContinue) {
+    walkContinue = false;
+    module->walk([&](FunctionOpInterface funcOp) {
+      if (funcOp.isPublic() || funcOp.isExternal())
+        return;
+
+      SymbolTable::UseRange uses = *funcOp.getSymbolUses(module);
----------------
joker-eph wrote:

Isn't this super expensive to build?

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


More information about the Mlir-commits mailing list