[Mlir-commits] [mlir] [mlir][func] Fix multiple bugs in `DuplicateFunctionElimination` (PR #109571)
Mehdi Amini
llvmlistbot at llvm.org
Mon Sep 23 13:52:34 PDT 2024
================
@@ -97,14 +101,14 @@ struct DuplicateFunctionEliminationPass
}
});
- // Update call ops to call unique func op representants.
- module.walk([&](func::CallOp callOp) {
- func::FuncOp callee = getRepresentant[callOp.getCalleeAttr().getAttr()];
- callOp.setCallee(callee.getSymName());
- });
-
- // Erase redundant func ops.
+ // Update all symbol uses to reference unique func op
+ // representants and erase redundant func ops.
for (auto it : toBeErased) {
+ auto oldSymbol = it.getSymNameAttr();
+ auto newSymbol = getRepresentant[oldSymbol].getSymNameAttr();
+ if (failed(
+ SymbolTable::replaceAllSymbolUses(oldSymbol, newSymbol, module)))
----------------
joker-eph wrote:
Such an API may work indeed.
https://github.com/llvm/llvm-project/pull/109571
More information about the Mlir-commits
mailing list