[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:22:01 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:
I must admit I wasn't particularly well-versed in many of the MLIR passes, but I've gained a much better understanding now. Ha ha.😘
Actually, I just took another look at the code for this pass. The most immediate issue stems from directly deleting the operands of `cond_br`. The underlying problem remains the data flow analysis issue mentioned earlier.
https://github.com/llvm/llvm-project/pull/161471
More information about the Mlir-commits
mailing list