[Mlir-commits] [mlir] [mlir] Enable remove-dead-values to delete unused private function (PR #161471)
lonely eagle
llvmlistbot at llvm.org
Thu Oct 9 01:22:36 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);
----------------
linuxlonelyeagle wrote:
It certainly feels super expensive.I've updated the code so that it now only runs on functions that are likely to be dead functions.
https://github.com/llvm/llvm-project/pull/161471
More information about the Mlir-commits
mailing list