[Mlir-commits] [mlir] [mlir] Enable remove-dead-values to delete unused private function (PR #161471)
lonely eagle
llvmlistbot at llvm.org
Fri Oct 10 10:27:02 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's a bit of a pity that -symbol-dce isn't implemented via patterns; otherwise, it might have been possible to incorporate it into remove-dead-values.To be perfectly honest, I know what the best fix is.Indeed, deleting dead functions is not the best approach.
https://github.com/llvm/llvm-project/pull/161471
More information about the Mlir-commits
mailing list